|
@@ -611,7 +611,6 @@ class TaskPool(BasePool):
|
|
|
|
|
|
|
|
|
|
|
|
- print('NUMJOBS: %r' % (len(self._pool._cache), ))
|
|
|
if outbound:
|
|
|
hub_add(diff(active_writes), schedule_writes, WRITE | ERR)
|
|
|
self.on_poll_start = on_poll_start
|
|
@@ -631,7 +630,7 @@ class TaskPool(BasePool):
|
|
|
|
|
|
|
|
|
if ready_fd in active_writes:
|
|
|
-
|
|
|
+
|
|
|
return
|
|
|
try:
|
|
|
job = pop_message()
|
|
@@ -652,7 +651,13 @@ class TaskPool(BasePool):
|
|
|
except KeyError:
|
|
|
|
|
|
return put_message(job)
|
|
|
- cor = _write_job(ready_fd, job)
|
|
|
+ try:
|
|
|
+ proc = fileno_to_inq[ready_fd]
|
|
|
+ except KeyError:
|
|
|
+
|
|
|
+
|
|
|
+ return put_message(job)
|
|
|
+ cor = _write_job(proc, ready_fd, job)
|
|
|
job._writer = ref(cor)
|
|
|
mark_write_gen_as_active(cor)
|
|
|
mark_write_fd_as_active(ready_fd)
|
|
@@ -684,7 +689,7 @@ class TaskPool(BasePool):
|
|
|
raise Exception(
|
|
|
'Process writable but cannot write. Contact support!')
|
|
|
|
|
|
- def _write_job(fd, job):
|
|
|
+ def _write_job(proc, fd, job):
|
|
|
|
|
|
|
|
|
|
|
@@ -692,13 +697,6 @@ class TaskPool(BasePool):
|
|
|
header, body, body_size = job._payload
|
|
|
errors = 0
|
|
|
try:
|
|
|
- try:
|
|
|
- proc = fileno_to_inq[fd]
|
|
|
- except KeyError:
|
|
|
-
|
|
|
-
|
|
|
- put_message(job)
|
|
|
- raise StopIteration()
|
|
|
|
|
|
job._write_to = proc
|
|
|
send = proc.send_job_offset
|