server
server copied to clipboard
fix(profile): Set profile config cache directly after writing it to DB
In ProfileManager::getProfileParams we make a lot of indirect calls to ProfileManager::getProfileConfig. The first time we get the call we get into the catch and insert data, and the next time we miss the cache and do the select. There's a possibility of read-after-write issue here (the database r/o-mirror doesn't have the inserted config yet), which leads to conflicts when it tries to reinsert the config. To avoid that, let's put the config value in the configcache directly when it's written.
Fixes:
OC\DB\Exceptions\DbalException
An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « profile_config_user_id_idx »
DETAIL: La clé « (user_id)=(Directrice) » existe déjà.
Checklist
- Code is properly formatted
- Sign-off message is added to all commits
- [ ] Tests (unit, integration, api and/or acceptance) are included
- [ ] Screenshots before/after for front-end changes
- [ ] Documentation (manuals or wiki) has been updated or is not required
- [ ] Backports requested where applicable (ex: critical bugfixes)
This makes AccountMigrator tests unhappy for some reason. If you know why @Pytal