Giter Club home page Giter Club logo

Comments (6)

pvojnov avatar pvojnov commented on July 30, 2024 3

Hi, i have the same issue but the provided fix didn't solve it.

By looking at the code it seems that the CronJobLog record doesn't get inserted to the database until the job finishes.
That way the query in CronJobManager.should_run_now wont find the job that is already running and start the job again before the first one finishes.

I've made a quick fix to CronJobManager.run by adding:
self.make_log('Job Running!!', success=True)
Just before the line:
self.msg = self.cron_job.do()

And it works!! :)

from django-cron.

DanEEStar avatar DanEEStar commented on July 30, 2024

I have the same problem.
A job which should run once a day, configured via run_at_times seems to run every minute.
Python processes are started every minute and get never killed.

I didn't use this library before version 0.5.0 so I cannot say if it has something to do with the upgrade...

Even worse, this behavior was only seen on the production environment. On out staging environment it seemed to work. The staging and prod environment use the same libraries and dependencies, so this is really strange...

from django-cron.

craiglabenz avatar craiglabenz commented on July 30, 2024

Have you verified that as soon as a job starts, an entry appears in the log table?

from django-cron.

DanEEStar avatar DanEEStar commented on July 30, 2024

When I was viewing the log table, after about 10 minutes of the deploy, there were multiple entries of the same job in there. Each one had a start time of 1 minute apart.
Then I killed all python processes. I also delete all entries in the job table.

Then when I restarted the application the job got started multiple times again, as I could verify via the ps command on the server. But it did not create new entries in the job table. The job table remained empty this time...

Sorry that I cannot be more specific. But the behaviour forced me to make some emergency adjustments after the deploy.
I can try it again, when I have more time.

from django-cron.

tab-cmd avatar tab-cmd commented on July 30, 2024

@DanEEStar and @sulami the only difference I could see between the two envs and versions would be in how we get the time now:

def get_current_time():
now = utc_now()
return now if is_naive(now) else localtime(now)

What is your timezone and is it USE_TZ? I think I know how to fix, but want to make sure. Could you locally be working in different timezones between env settings? Thanks for the info

from django-cron.

sulami avatar sulami commented on July 30, 2024

I don't have access to the environment in question anymore, but we did use USE_TZ, and I'm pretty sure the servers were in Ireland (AWS).

from django-cron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.