Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue in db_periodic_task()

See original GitHub issue
@db_periodic_task(crontab(minute='0', hour='15'))
def notify_user():
    # do something

I was trying to run a periodic task that runs at 3 pm every day. I used the above sample code to do this. The task executed at 3 pm, now the issue is that after executing one time this task was running continuously every minute while I just need to execute this task at 3 pm every day.

Is there something wrong with my crontab config or is this the issue with Huey.

Also, if I want to run a task at 9 am and 3 pm every day, what should be the crontab config.


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

sumit4613commented, Sep 11, 2020

Okay, will remember this from next time. 😅

coleifercommented, Sep 11, 2020

I think that something must be wrong in either a) your explanation of the issue, b) discrepancies between your actual code and what you pasted.

I ran a very minimal test django startproject / django startapp and a placeholder db periodic task that specifies a particular minute and hour, and it’s working fine:

[2020-09-11 13:26:13,788] INFO:huey.consumer.Scheduler:Scheduler:Enqueueing periodic task foo.tasks.test_periodic_task: 5f27b16f-2f50-45c2-bc39-748f38bb7bc6.
[2020-09-11 13:26:13,789] INFO:huey:Worker-1:Executing foo.tasks.test_periodic_task: 5f27b16f-2f50-45c2-bc39-748f38bb7bc6
hello world
[2020-09-11 13:26:13,789] INFO:huey:Worker-1:foo.tasks.test_periodic_task: 5f27b16f-2f50-45c2-bc39-748f38bb7bc6 executed in 0.000s

After executing once, the task did not run again while I observed.

Also, I would be very surprised to find something so fundamental in huey to be broken.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found