Skip to content

Commit

Permalink
IntervalRunner: don't wait for interval_seconds on shutdown (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
KostyaEsmukov committed Jun 14, 2021
1 parent fc90f6f commit 32d8ae9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions slack_sdk/socket_mode/interval_runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import threading
import time
from threading import Thread, Event
from typing import Callable

Expand All @@ -18,7 +17,7 @@ def __init__(self, target: Callable[[], None], interval_seconds: float = 0.1):
def _run(self) -> None:
while not self.event.is_set():
self.target()
time.sleep(self.interval_seconds)
self.event.wait(self.interval_seconds)

def start(self) -> "IntervalRunner":
self.thread.start()
Expand Down

0 comments on commit 32d8ae9

Please sign in to comment.