| 58 | return; |
| 59 | } |
| 60 | const testFinished = () => { |
| 61 | if (availablePythonCallers.length < pythonCallers.length) { |
| 62 | // keep waiting for all pythonCallers to be returned |
| 63 | debug('finish(): waiting for availablePythonCallers'); |
| 64 | setTimeout(testFinished, 100); |
| 65 | } else { |
| 66 | debug('finish(): calling done() on all pythonCallers'); |
| 67 | for (let i = 0; i < pythonCallers.length; i++) { |
| 68 | pythonCallers[i].done(); |
| 69 | } |
| 70 | pythonCallers = []; |
| 71 | availablePythonCallers = []; |
| 72 | return callback(null); |
| 73 | } |
| 74 | }; |
| 75 | testFinished(); |
| 76 | }, |
| 77 | |