Merge branch 'main' into avm99963-monorail
Merged commit 3779da353b36d43cf778e7d4f468097714dd4540
GitOrigin-RevId: 6451a5c6b75afb0fd1f37b3f14521148d0722ea8
diff --git a/services/cachemanager_svc.py b/services/cachemanager_svc.py
index 02ad6dd..753bffa 100644
--- a/services/cachemanager_svc.py
+++ b/services/cachemanager_svc.py
@@ -44,6 +44,7 @@
import logging
from framework import jsonfeed
+from framework import logger
from framework import sql
@@ -119,19 +120,26 @@
def StoreInvalidateRows(self, cnxn, kind, keys):
"""Store rows to let all jobs know to invalidate the given keys."""
assert kind in INVALIDATE_KIND_VALUES
+ logger.log(
+ {
+ 'log_type': 'cache/invalidate/rows',
+ 'kind': kind,
+ 'count': len(keys),
+ 'keys': str(keys),
+ })
self.invalidate_tbl.InsertRows(
cnxn, ['kind', 'cache_key'], [(kind, key) for key in keys])
def StoreInvalidateAll(self, cnxn, kind):
"""Store a value to tell all jobs to invalidate all items of this kind."""
+ logger.log({'log_type': 'cache/invalidate/all', 'kind': kind})
last_timestep = self.invalidate_tbl.InsertRow(
cnxn, kind=kind, cache_key=INVALIDATE_ALL_KEYS)
self.invalidate_tbl.Delete(
cnxn, kind=kind, where=[('timestep < %s', [last_timestep])])
-# TODO: change to FlaskInternalTask when convert to Flask
-class RamCacheConsolidate(jsonfeed.InternalTask):
+class RamCacheConsolidate(jsonfeed.FlaskInternalTask):
"""Drop old Invalidate rows when there are too many of them."""
def HandleRequest(self, mr):
@@ -166,8 +174,5 @@
'new_count': new_count,
}
- # def GetRamCacheConsolidate(self, **kwargs):
- # return self.handler(**kwargs)
-
- # def PostRamCacheConsolidate(self, **kwargs):
- # return self.handler(**kwargs)
+ def GetRamCacheConsolidate(self, **kwargs):
+ return self.handler(**kwargs)