Skip to content

Commit 11ae785

Browse files
committed
fix: cache the proxy strength (not changing that often...)
1 parent d23a54e commit 11ae785

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/DIRAC/FrameworkSystem/DB/ProxyDB.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* ProxyDB_Log -- table with logs.
1010
"""
1111
import textwrap
12+
from threading import Lock
13+
14+
from cachetools import TTLCache, cached
1215

1316
from DIRAC import S_ERROR, S_OK, gLogger
1417
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
@@ -395,6 +398,7 @@ def deleteProxy(self, userDN, userGroup=None, proxyProvider=None):
395398
return S_ERROR(", ".join(errMsgs))
396399
return result
397400

401+
@cached(TTLCache(maxsize=1000, ttl=600), lock=Lock())
398402
def getProxyStrength(self, userDN, userGroup=None, vomsAttr=None):
399403
"""Load the proxy in cache corresponding to the criteria, and check its strength
400404

0 commit comments

Comments
 (0)