Skip to content

Commit

Permalink
Loop through queue instead of rebuilding
Browse files Browse the repository at this point in the history
  • Loading branch information
calebj committed Apr 2, 2016
1 parent 116b878 commit a604e3f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sopel/tools/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ def add_job(self, job):
self._jobs.put(job)

def del_job(self, del_job):
newjobs = PriorityQueue()
while self._jobs.not_empty:
for i in range(self._jobs.qsize()):
job = self._jobs.get()
if job is not del_job:
newjobs.put()
self._jobs = newjobs
if job and job is not del_job:
self._jobs.put(job)

def clear_jobs(self):
"""Clear current Job queue and start fresh."""
Expand Down

0 comments on commit a604e3f

Please sign in to comment.