mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-21 21:44:19 +00:00
Fix #63
This commit is contained in:
parent
faaeb08773
commit
bd1b98437d
2 changed files with 5 additions and 1 deletions
2
core.py
2
core.py
|
@ -100,7 +100,7 @@ def main():
|
|||
# Otherwise, forward the update to the corresponding worker
|
||||
receiving_worker = chat_workers.get(update.message.chat.id)
|
||||
# Ensure a worker exists for the chat and is alive
|
||||
if receiving_worker is None or not receiving_worker.is_alive():
|
||||
if receiving_worker is None or not receiving_worker.is_ready():
|
||||
log.debug(f"Received a message in a chat without worker: {update.message.chat.id}")
|
||||
# Suggest that the user restarts the chat with /start
|
||||
bot.send_message(update.message.chat.id, default_loc.get("error_no_worker_for_chat"),
|
||||
|
|
|
@ -130,6 +130,10 @@ class Worker(threading.Thread):
|
|||
self.sentry_client.captureException()
|
||||
traceback.print_exception(*sys.exc_info())
|
||||
|
||||
def is_ready(self):
|
||||
# Change this if more parameters are added!
|
||||
return self.loc is not None
|
||||
|
||||
def stop(self, reason: str = ""):
|
||||
"""Gracefully stop the worker process"""
|
||||
# Send a stop message to the thread
|
||||
|
|
Loading…
Reference in a new issue