rq / django-rq

A simple app that provides django integration for RQ (Redis Queue)
MIT License
1.81k stars 286 forks source link

get_status not updating for job? #578

Closed ansocha closed 1 year ago

ansocha commented 1 year ago

Don't know why, but I always get None for job.get_status()

When I iterate through jobs in the queue. The job is scheduled and runs and I get the job ID with job.id.

But get_status and all these are always False is_started, is_failed, is_queued, is_scheduled, etc...

So I schedule the job in the queue:

job = scheduler.enqueue_in(timedelta(seconds=15), someFunc)

Then when I iterate through all jobs in the queue it always gives me None for get_status

Within I should get True for is_scheduled no?

    list_of_job_instances = scheduler.get_jobs()
    for j in list_of_job_instances:
        print(j.get_status())#None

I've tried this many ways and don't know what I'm missing or if this is a bug. Agan I confirm the job is scheduled and is_scheduled still gets me False and get_status gives me None for the job:

        list_of_job_instances = scheduler.get_jobs()
        for job in list_of_job_instances:
            if job in scheduler:
                                 print('Job is in scheduler')# this is fine
selwin commented 1 year ago

You should use job.get_status(refresh=True)