forked from slackapi/bolt-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner.py
More file actions
29 lines (22 loc) · 1.02 KB
/
runner.py
File metadata and controls
29 lines (22 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from abc import abstractmethod, ABCMeta
from logging import Logger
from typing import Callable
from slack_bolt.lazy_listener.internals import build_runnable_function
from slack_bolt.request import BoltRequest
class LazyListenerRunner(metaclass=ABCMeta):
logger: Logger
@abstractmethod
def start(self, function: Callable[..., None], request: BoltRequest) -> None:
"""Starts a new lazy listener execution.
:param function: The function to run.
:param request: The request to pass to the function. The object must be thread-safe.
:return: None
"""
raise NotImplementedError()
def run(self, function: Callable[..., None], request: BoltRequest) -> None:
"""Synchronously run the function with a given request data.
:param function: The function to run.
:param request: The request to pass to the function. The object must be thread-safe.
:return: None
"""
build_runnable_function(func=function, logger=self.logger, request=request,)()