You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The applied fix to add a sleep will solve the immediate issue. The proper way to handle tasks is to use a task/event scheduler (https://docs.python.org/3/library/sched.html#). If you want to repeatedly run them make sure the task reschedules itself. This way you have more control over, can cancel it at any time, and still execute it even if an exception is thrown in the function.
A second improvement you can implement, if you want t really clean code, do not run the delete task in a fixed delay loop but rather just as necessary. You can retrieve the oldest/newest time in the sql query and compute the next time a deletion operation is necessary and schedule the appropriate task right away.
In your last commit (49469f8) you might have missed this loop
https://github.com/xXAligatorXx/RepostCheckerBot/blob/d43b314d874f78e695f49b7c4f5b7e4063cc6a2c/database.py#L250-L266
The applied fix to add a sleep will solve the immediate issue. The proper way to handle tasks is to use a task/event scheduler (https://docs.python.org/3/library/sched.html#). If you want to repeatedly run them make sure the task reschedules itself. This way you have more control over, can cancel it at any time, and still execute it even if an exception is thrown in the function.
A second improvement you can implement, if you want t really clean code, do not run the delete task in a fixed delay loop but rather just as necessary. You can retrieve the oldest/newest time in the sql query and compute the next time a deletion operation is necessary and schedule the appropriate task right away.
https://github.com/xXAligatorXx/RepostCheckerBot/blob/d43b314d874f78e695f49b7c4f5b7e4063cc6a2c/app.py#L43
The text was updated successfully, but these errors were encountered: