diff --git a/release.notes b/release.notes index 8958da90406..90287e94fe2 100644 --- a/release.notes +++ b/release.notes @@ -211,6 +211,12 @@ NEW: (#4910) --runslow option on unit tests to allow faster local tests NEW: (#4938) added a helloworld test for the (yet to be implemented) cloud testing in certification CHANGE: (#4968) Change the defaults for tests (to MySQL 8 and ES 7) +[v7r1p42] + +*Framework +FIX: (#5168) Avoid minor caching bug which causes constraints to be violated when rapidly + writing to UserProfileDB + [v7r1p41] *Accounting diff --git a/src/DIRAC/FrameworkSystem/DB/UserProfileDB.py b/src/DIRAC/FrameworkSystem/DB/UserProfileDB.py index fdf7e1b79c2..3be0c457da8 100755 --- a/src/DIRAC/FrameworkSystem/DB/UserProfileDB.py +++ b/src/DIRAC/FrameworkSystem/DB/UserProfileDB.py @@ -136,16 +136,17 @@ def __getFieldsCached(self, tableName, outFields, condDict): TTL cache to dramatically improve performance. """ key = (tableName, tuple(outFields), tuple(sorted(condDict.items()))) - if key not in self.__cache: - result = self.getFields(tableName, outFields, condDict) - if not result['OK']: - return result - data = result['Value'] - if len(data) > 0: - objId = data[0][0] - self.updateFields(tableName, ['LastAccess'], ['UTC_TIMESTAMP()'], {'Id': objId}) + if key in self.__cache: + return self.__cache[key] + result = self.getFields(tableName, outFields, condDict) + if not result['OK']: + return result + data = result['Value'] + if len(data) > 0: + objId = data[0][0] + self.updateFields(tableName, ['LastAccess'], ['UTC_TIMESTAMP()'], {'Id': objId}) self.__cache[key] = result - return self.__cache[key] + return result def __getObjId(self, objValue, varName, tableName, insertIfMissing=True): result = self.__getFieldsCached(tableName, ['Id'], {varName: objValue})