diff options
| author | Selwin Ong <selwin.ong@gmail.com> | 2017-10-28 17:30:59 +0700 |
|---|---|---|
| committer | Selwin Ong <selwin.ong@gmail.com> | 2017-10-28 17:30:59 +0700 |
| commit | abfe8581606393658d032429c7259829db2b14de (patch) | |
| tree | ccc89786f363a631100649b45efa7c755e6fcfc4 | |
| parent | 6aad7d821e22a46105a9c92d4f1c66c583160ab3 (diff) | |
| download | rq-worker-statistics.tar.gz | |
handle_job_failure shouldn't crash if job.started_at is not present.worker-statistics
| -rw-r--r-- | rq/worker.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/rq/worker.py b/rq/worker.py index 810fbab..946995e 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -699,8 +699,9 @@ class Worker(object): started_job_registry.remove(job, pipeline=pipeline) self.set_current_job_id(None, pipeline=pipeline) self.increment_failed_job_count(pipeline) - self.increment_total_working_time(job.ended_at - job.started_at, - pipeline) + if job.started_at and job.ended_at: + self.increment_total_working_time(job.ended_at - job.started_at, + pipeline) try: pipeline.execute() |
