From bd27631dd1f66a2f3ceb80c0f2a84004efc2338f Mon Sep 17 00:00:00 2001 From: PIG208 <359101898@qq.com> Date: Wed, 26 May 2021 23:09:35 +0800 Subject: [PATCH] zulip-bots: Yield cache storage instead bot storage. Fixes the bug that the context manager doesn't actually manage the storage. --- zulip_bots/zulip_bots/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index d7f9023..b6fe334 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -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. data = {key: storage.get(key) for key in keys} cache = CachedStorage(storage, data) - yield storage + yield cache cache.flush() class BotHandler(Protocol):