Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid adding jobs to job list twice

  • Loading branch information...
commit 7cd4edd05b09227cf9a210909151eff4d2fe8af5 1 parent 4defbec
@jonasvp authored
View
3  django_beanstalkd/decorators.py
@@ -18,7 +18,8 @@ def __init__(self, f):
# store function in per-app job list (to be picked up by a worker)
bs_module = __import__(f.__module__)
try:
- bs_module.beanstalk_job_list.append(self)
+ if self not in bs_module.beanstalk_job_list:
+ bs_module.beanstalk_job_list.append(self)
except AttributeError:
bs_module.beanstalk_job_list = [self]
View
5 django_beanstalkd/management/commands/beanstalk_worker.py
@@ -34,10 +34,9 @@ def handle_noargs(self, **options):
jobs = []
for bs_module in bs_modules:
try:
- bs_module.beanstalk_job_list
+ jobs += bs_module.beanstalk_job_list
except AttributeError:
- continue
- jobs += bs_module.beanstalk_job_list
+ pass
if not jobs:
print "No beanstalk jobs found!"
return
Please sign in to comment.
Something went wrong with that request. Please try again.