Hello, I am trying to run a database query using the web2py scheduler, but for some reason I can't get the query to commit. I've tested the function in a controller to see that it works, and I'm pretty sure the scheduler is running correctly because I have a scheduler_worker with the status of ACTIVE in my backend.
this is my scheduler.py in models:
from gluon.scheduler import Scheduler
scheduler = Scheduler(db)
def delete_after_hours():
current_start = now
start = current_start.replace(tzinfo=utc)
rows = db(
db.public_uploads.id > 0).select()
for row in rows:
end_time = row.end_time
end = end_time.replace(tzinfo=utc)
if start >= end:
row.delete_record()
scheduler.queue_task(delete_after_hours)
Thanks in advance for any advice.
*cheers