mirror of https://github.com/rq/rq.git
Added connection argument to get_current_job()
This commit is contained in:
parent
c106604f17
commit
f0a3dd262e
|
@ -56,14 +56,14 @@ def requeue_job(job_id, connection=None):
|
|||
fq.requeue(job_id)
|
||||
|
||||
|
||||
def get_current_job():
|
||||
def get_current_job(connection=None):
|
||||
"""Returns the Job instance that is currently being executed. If this
|
||||
function is invoked from outside a job context, None is returned.
|
||||
"""
|
||||
job_id = _job_stack.top
|
||||
if job_id is None:
|
||||
return None
|
||||
return Job.fetch(job_id)
|
||||
return Job.fetch(job_id, connection=connection)
|
||||
|
||||
|
||||
class Job(object):
|
||||
|
|
Loading…
Reference in New Issue