-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed dialog checking and new day to periodic tasks #91
Conversation
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK this looks cleaner than before :) I assume using celery's periodic tasks is more robust than the async stuff from before?
@@ -68,16 +64,12 @@ def check_dialogs_status(self): # pylint: disable=unused-argument | |||
fsm.dialog_state.set_to_idle() | |||
save_state_machine_to_db(fsm) | |||
|
|||
next_day = datetime.now().replace(hour=10, minute=00) + timedelta(days=1) | |||
next_day = datetime.now().replace(hour=00, minute=00) + timedelta(days=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new day used to start at 10am?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it didn't make a lot of sense. I mean, I am not yet so lucky to be in the position of denying the existence of the early morning hours XD
## TODO: uncomment and solve issue | ||
# check_dialogs_status.apply_async() | ||
sender.add_periodic_task(crontab(hour=00, minute=00), notify_new_day.s(datetime.today())) | ||
sender.add_periodic_task(MAXIMUM_DIALOG_DURATION, check_dialogs_status.s()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I'm wondering about - I think we configured Celery to use the redis key-value store for storing its tasks. If the current docker-compose setup goes down, the contents of that store are lost, so on restarting the app it should be completely clear (no celery tasks set at all). So the app initially sets up every celery task it needs just from reading the db. Is this the correct way to understand it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good point, and it might be a problem if we want, for example, to update the system. At the moment the app sets up just recurrent tasks for checks that need to be done periodically, but it doesn't restore the scheduled tasks that have not been executed. This information is in the DB, so we "just" need to read the info from there. I opening an issue for that.
Fixes: PerfectFit-project/virtual-coach-issues#344