dsh-dl-server 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/lib/queue.js +8 -2
  2. package/package.json +1 -1
package/lib/queue.js CHANGED
@@ -606,8 +606,10 @@ export class Queue {
606
606
  } catch (error) {
607
607
  const aborted = controller.signal.aborted
608
608
  if (aborted) {
609
- // pause / cancel / close already recorded the target state
610
- if (!isTerminal(record.state)) {
609
+ // pause / cancel / close already recorded the target state. Only park it
610
+ // here when nobody else transitioned the job — a resume that landed
611
+ // while this transfer was unwinding must not be undone.
612
+ if (record.state === 'running') {
611
613
  await this.#stopAs(id, 'host_restart')
612
614
  }
613
615
  } else {
@@ -644,6 +646,10 @@ export class Queue {
644
646
  async #stopAs(id, reason) {
645
647
  const record = this.jobs.get(id)
646
648
  if (!record || isTerminal(record.state)) return
649
+ // Only an in-flight job may be stopped. A pause already parked it, and a
650
+ // resume may have re-queued it while the aborted transfer was still
651
+ // unwinding — overwriting that would leave the job stuck in `paused`.
652
+ if (record.state !== 'running' && record.state !== 'queued') return
647
653
  const stats = this.progress.get(id)
648
654
  record.state = 'paused'
649
655
  record.pauseReason = reason
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-dl-server",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "DLS — DSH Download Server: a global, session-aware, persistent download queue for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",