done, pending = await asyncio.wait(
pending, timeout=self.timeout,
return_when=asyncio.FIRST_COMPLETED)
- self.pending = pending
-
- for task in done:
- bookmark, _, old_task = bookmarks.pop(task.href)
- assert old_task is task
- log = self.file_log
- log_lines = self.logs.pop(bookmark.href)
- log('Checked: %s' % bookmark.href)
- if log_lines:
- for line in log_lines:
- log(line)
- else:
- if hasattr(bookmark, 'error'):
- log(' Error: %s' % bookmark.error)
+ self.pending = pending
+
+ for task in done:
+ bookmark, _, old_task = bookmarks.pop(task.href)
+ assert old_task is task
+ log = self.file_log
+ log_lines = self.logs.pop(bookmark.href)
+ log('Checked: %s' % bookmark.href)
+ if log_lines:
+ for line in log_lines:
+ log(line)
else:
- log(' No logs')
+ if hasattr(bookmark, 'error'):
+ log(' Error: %s' % bookmark.error)
+ else:
+ log(' No logs')
def stop(self):
super(robot_aio, self).stop()
done, pending = concurrent.futures.wait(
pending, self.timeout,
return_when=concurrent.futures.FIRST_COMPLETED)
- self.pending = pending
-
- for ft in done:
- new_bkmk, log_lines = ft.result()
- bookmark, parent, old_ft = bookmarks.pop(new_bkmk.href)
- assert old_ft is ft
- if new_bkmk is not bookmark: # unpickled from a subprocess
- copy_bkmk(new_bkmk, bookmark)
- bookmark.parent = parent
- log('Checked: %s' % bookmark.href)
- for line in log_lines:
- log(line)
+ self.pending = pending
+
+ for ft in done:
+ new_bkmk, log_lines = ft.result()
+ bookmark, parent, old_ft = bookmarks.pop(new_bkmk.href)
+ assert old_ft is ft
+ if new_bkmk is not bookmark: # unpickled from a subprocess
+ copy_bkmk(new_bkmk, bookmark)
+ bookmark.parent = parent
+ log('Checked: %s' % bookmark.href)
+ for line in log_lines:
+ log(line)
def stop(self):
super(concurrent_futures, self).stop()