MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / tryGet

Method tryGet

ui/easydiffusion/task_manager.py:144–155  ·  view source on GitHub ↗
(self, key: Hashable)

Source from the content-addressed store, hash-verified

142 self._lock.release()
143
144 def tryGet(self, key: Hashable) -> Any:
145 if not self._lock.acquire(blocking=True, timeout=LOCK_TIMEOUT):
146 raise Exception("DataCache.tryGet" + ERR_LOCK_FAILED)
147 try:
148 ttl, value = self._base.get(key, (None, None))
149 if ttl is not None and self._is_expired(ttl):
150 log.debug(f"Session {key} expired. Discarding data.")
151 del self._base[key]
152 return None
153 return value
154 finally:
155 self._lock.release()
156
157
158manager_lock = threading.RLock()

Callers 3

tasksMethod · 0.80
get_cached_taskFunction · 0.80
get_cached_sessionFunction · 0.80

Calls 2

_is_expiredMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected