moved job run to separate method to make async jobs easier

main
Marko Mrdjenovic 8 years ago
parent b241d50c10
commit 3da3eab11d

@ -227,13 +227,17 @@ class Queue(object):
job = self.enqueue_job(job, at_front=at_front) job = self.enqueue_job(job, at_front=at_front)
if not self._async: if not self._async:
job.perform() job = self.run_job(job)
job.set_status(JobStatus.FINISHED)
job.save()
job.cleanup(DEFAULT_RESULT_TTL)
return job return job
def run_job(self, job):
job.perform()
job.set_status(JobStatus.FINISHED)
job.save()
job.cleanup(DEFAULT_RESULT_TTL)
return job
def enqueue(self, f, *args, **kwargs): def enqueue(self, f, *args, **kwargs):
"""Creates a job to represent the delayed function call and enqueues """Creates a job to represent the delayed function call and enqueues
it. it.

Loading…
Cancel
Save