Skip to content

Commit

Permalink
Conflicts resolved with rel-v7r1
Browse files Browse the repository at this point in the history
  • Loading branch information
atsareg committed Jun 2, 2021
2 parents 00a99c6 + 761cdcb commit 7ae10cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 6 additions & 0 deletions release.notes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions src/DIRAC/FrameworkSystem/DB/UserProfileDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 7ae10cf

Please sign in to comment.