Skip to content

Commit 637fe0d

Browse files
fix cache
1 parent 3da759d commit 637fe0d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cads_broker/dispatcher.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Broker:
110110
session_maker_read: sa.orm.sessionmaker
111111
session_maker_write: sa.orm.sessionmaker
112112
wait_time: float = float(os.getenv("BROKER_WAIT_TIME", 2))
113-
cache = cachetools.TTLCache(
113+
ttl_cache = cachetools.TTLCache(
114114
maxsize=1024, ttl=int(os.getenv("SYNC_DATABASE_CACHE_TIME", 10))
115115
)
116116

@@ -158,9 +158,7 @@ def number_of_workers(self):
158158
self.environment.number_of_workers = number_of_workers
159159
return number_of_workers
160160

161-
@cachetools.cachedmethod( # type: ignore
162-
cache=cache,
163-
)
161+
@cachetools.cachedmethod(lambda self: self.ttl_cache)
164162
def sync_database(self, session: sa.orm.Session) -> None:
165163
"""Sync the database with the current status of the dask tasks.
166164

0 commit comments

Comments
 (0)