code: function finalizeRequestDone() {
      if (PendingRequests.length) {
          // If we have queued requests, we execute the next one
          currentRequest = PendingRequests.shift();
          Log(3, "Executing request", currentRequest.id);
          executeRequest(currentRequest);
      } else {
          // We set a timeout in case of other requests blocked in the process
          executing = false;
          PendingTimeout = setTimeout(() => {
              if (Object.keys(PendingRequests).length == 0) {
                  // Telling main thread that he can kill us if he wants
                  Log(3, "Inactive thread");
                  process.send({name: "thread-no-pending-requests", args: [{threadId: threadId}]});
              }
          }, 1000);
      }
  
  }
docs: Finalize a request when it is done