aboutsummaryrefslogtreecommitdiffstats
path: root/slack/shared.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-12 22:47:51 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commitadf20323ce99e8829a2ab53f8d487f5704d28320 (patch)
tree85c008fdc7c115c9d0d9cc2eaf056cc0aab83b5b /slack/shared.py
parent7574554b09eacb7aaaa8610d73fef6bd9d8a363f (diff)
downloadwee-slack-adf20323ce99e8829a2ab53f8d487f5704d28320.tar.gz
Don't fetch the same user multiple times
Diffstat (limited to 'slack/shared.py')
-rw-r--r--slack/shared.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/slack/shared.py b/slack/shared.py
index 68400a2..f972c2b 100644
--- a/slack/shared.py
+++ b/slack/shared.py
@@ -1,11 +1,12 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Any, Dict, Tuple
+from collections import defaultdict
+from typing import TYPE_CHECKING, Any, Dict, List, Tuple
if TYPE_CHECKING:
from slack.api import SlackWorkspace
from slack.config import SlackConfig
- from slack.task import Task
+ from slack.task import Future, Task
class Shared:
@@ -15,7 +16,8 @@ class Shared:
self.weechat_version: int
self.weechat_callbacks: Dict[str, Any]
- self.active_tasks: Dict[str, Task[Any]] = {}
+ self.active_tasks: Dict[str, List[Task[Any]]] = defaultdict(list)
+ self.active_futures: Dict[str, Future[Any]] = {}
self.active_responses: Dict[str, Tuple[Any, ...]] = {}
self.workspaces: Dict[str, SlackWorkspace] = {}
self.config: SlackConfig