mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Restart twitter forwarder in thread. (#2045)
This commit is contained in:
parent
f12957d25b
commit
8b2ef3ca4c
2 changed files with 8 additions and 5 deletions
|
|
@ -422,7 +422,7 @@ class SqueakController:
|
|||
profile_id,
|
||||
bearer_token,
|
||||
)
|
||||
self.update_twitter_stream()
|
||||
self.tweet_forwarder.restart()
|
||||
return twitter_account_id
|
||||
|
||||
def get_twitter_accounts(self) -> List[TwitterAccountEntry]:
|
||||
|
|
@ -438,7 +438,4 @@ class SqueakController:
|
|||
|
||||
def delete_twitter_account(self, twitter_account_id: int) -> None:
|
||||
self.squeak_store.delete_twitter_account(twitter_account_id)
|
||||
self.update_twitter_stream()
|
||||
|
||||
def update_twitter_stream(self) -> None:
|
||||
self.tweet_forwarder.start_processing()
|
||||
self.tweet_forwarder.restart()
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ class TwitterForwarder:
|
|||
self.lock = threading.Lock()
|
||||
self.current_tasks: Dict[str, TwitterForwarderTask] = {}
|
||||
|
||||
def restart(self):
|
||||
threading.Thread(
|
||||
target=self.start_processing,
|
||||
daemon=True,
|
||||
).start()
|
||||
|
||||
def start_processing(self):
|
||||
with self.lock:
|
||||
# Stop existing running tasks.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue