zulip-bots: Yield cache storage instead bot storage.
Fixes the bug that the context manager doesn't actually manage the storage.
This commit is contained in:
parent
06bbfd752e
commit
bd27631dd1
|
@ -164,7 +164,7 @@ def use_storage(storage: BotStorage, keys: List[Text]) -> Iterator[BotStorage]:
|
||||||
# calling flush or getting some values that are not previously fetched.
|
# calling flush or getting some values that are not previously fetched.
|
||||||
data = {key: storage.get(key) for key in keys}
|
data = {key: storage.get(key) for key in keys}
|
||||||
cache = CachedStorage(storage, data)
|
cache = CachedStorage(storage, data)
|
||||||
yield storage
|
yield cache
|
||||||
cache.flush()
|
cache.flush()
|
||||||
|
|
||||||
class BotHandler(Protocol):
|
class BotHandler(Protocol):
|
||||||
|
|
Loading…
Reference in a new issue