Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

fix bug: scheduler's projects size change in subthread while main thread iterate #842

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyspider/scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def _check_cronjob(self):
if now - self._last_tick < 1:
return False
self._last_tick += 1
for project in itervalues(self.projects):
for project in self.projects.values():
if not project.active:
continue
if project.waiting_get_info:
Expand Down Expand Up @@ -481,7 +481,7 @@ def _check_select(self):

# dynamic assign select limit for each project, use qsize as weight
project_weights, total_weight = dict(), 0
for project in itervalues(self.projects): # type:Project
for project in self.projects.values(): # type:Project
if not project.active:
continue
# only check project pause when select new tasks, cronjob and new request still working
Expand Down Expand Up @@ -630,7 +630,7 @@ def _try_dump_cnt(self):
def _check_delete(self):
'''Check project delete'''
now = time.time()
for project in list(itervalues(self.projects)):
for project in self.projects.values():
if project.db_status != 'STOP':
continue
if now - project.updatetime < self.DELETE_TIME:
Expand Down