@ubercode/dcmtk 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/servers.cjs CHANGED
@@ -3224,7 +3224,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
3224
3224
  this.wireRefusingAssociation(worker);
3225
3225
  this.wireOutputCapture(worker);
3226
3226
  }
3227
- /** Wires FILE_RECEIVED from dcmrecv worker to handleFileReceived. */
3227
+ /** Wires FILE_RECEIVED from dcmrecv worker files are processed serially per worker. */
3228
3228
  wireFileReceived(worker) {
3229
3229
  worker.dcmrecv.onFileReceived((data) => {
3230
3230
  const assocId = worker.associationId;
@@ -3241,7 +3241,6 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
3241
3241
  }
3242
3242
  const promise = this.handleFileReceived(worker, data, assocId, assocDir);
3243
3243
  worker.pendingFiles.push(promise);
3244
- void promise.finally(() => removePending(worker.pendingFiles, promise));
3245
3244
  });
3246
3245
  }
3247
3246
  /** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
@@ -3302,7 +3301,7 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
3302
3301
  }
3303
3302
  /** Awaits ALL pending file operations, emits ASSOCIATION_COMPLETE, resets worker state. */
3304
3303
  async finalizeAssociation(worker, data) {
3305
- while (worker.pendingFiles.length > 0) {
3304
+ if (worker.pendingFiles.length > 0) {
3306
3305
  await Promise.all(worker.pendingFiles);
3307
3306
  }
3308
3307
  this.emitAssociationComplete(worker, data);
@@ -3453,10 +3452,6 @@ async function removeDirSafe(dirPath) {
3453
3452
  } catch {
3454
3453
  }
3455
3454
  }
3456
- function removePending(arr, promise) {
3457
- const idx = arr.indexOf(promise);
3458
- if (idx !== -1) void arr.splice(idx, 1);
3459
- }
3460
3455
  function delay(ms) {
3461
3456
  return new Promise((resolve) => {
3462
3457
  setTimeout(resolve, ms);