function checkDrained() {
    if (tasks.length === 0 && runningCount === 0) {
      for (const cb of drainedCallbacks) {
        cb();
      }
    }
  }
We will trigger drained callbacks when:
  tasks.length === 0 and runningCount === 0