(threadN, batch_size)
| 538 | } |
| 539 | |
| 540 | async function scanThread(threadN, batch_size) { |
| 541 | let cidd; |
| 542 | |
| 543 | while (cidd = cidds.pop()) { |
| 544 | if (cidd['domain'] === tabDomain) { |
| 545 | const closingEvent = await scanCourse(cidd, threadN); |
| 546 | if (closingEvent === "stopped") { |
| 547 | console.log(`thread ${threadN} (cid: ${cidd['cid']}) - scanning stopped by user`); |
| 548 | return "stopped"; |
| 549 | }; |
| 550 | if (closingEvent === "unauthorised") { |
| 551 | console.log(`thread ${threadN} (cid: ${cidd['cid']}) - user is not logged in, scanning terminated`); |
| 552 | return "unauthorised"; |
| 553 | }; |
| 554 | } else { |
| 555 | console.warn(`${cidd} does not match downloading tab domain ${tabDomain}`); |
| 556 | } |
| 557 | batch_done++; |
| 558 | updBatchProgress(batch_done, batch_size, cidd); |
| 559 | } |
| 560 | |
| 561 | removeScanBar(threadN); |
| 562 | } |
| 563 | |
| 564 | |
| 565 | //batch scheduling |
no test coverage detected