@guanghechen/task 2.1.2 → 2.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Avoid RangeError when cancel() and complete() race.
8
+
3
9
  ## 2.1.2
4
10
 
5
11
  ### Patch Changes
package/lib/cjs/index.cjs CHANGED
@@ -146,7 +146,7 @@ class AtomicTask {
146
146
  async cancel() {
147
147
  if (this.status.terminated)
148
148
  return;
149
- this.status.next(exports.TaskStatusEnum.ATTEMPT_CANCELING);
149
+ this.status.next(exports.TaskStatusEnum.ATTEMPT_CANCELING, { strict: false });
150
150
  await this._promise;
151
151
  this.status.next(exports.TaskStatusEnum.CANCELLED, { strict: false });
152
152
  }
@@ -156,7 +156,7 @@ class AtomicTask {
156
156
  await this.start();
157
157
  if (status.terminated)
158
158
  return;
159
- status.next(exports.TaskStatusEnum.ATTEMPT_COMPLETING);
159
+ status.next(exports.TaskStatusEnum.ATTEMPT_COMPLETING, { strict: false });
160
160
  await this._promise;
161
161
  status.next(exports.TaskStatusEnum.COMPLETED, { strict: false });
162
162
  }
@@ -209,7 +209,7 @@ class ResumableTask {
209
209
  async cancel() {
210
210
  if (this.status.terminated)
211
211
  return;
212
- this.status.next(exports.TaskStatusEnum.ATTEMPT_CANCELING);
212
+ this.status.next(exports.TaskStatusEnum.ATTEMPT_CANCELING, { strict: false });
213
213
  await this._step;
214
214
  this.status.next(exports.TaskStatusEnum.CANCELLED, { strict: false });
215
215
  }
@@ -219,7 +219,7 @@ class ResumableTask {
219
219
  await this.start();
220
220
  if (status.terminated)
221
221
  return;
222
- status.next(exports.TaskStatusEnum.ATTEMPT_COMPLETING);
222
+ status.next(exports.TaskStatusEnum.ATTEMPT_COMPLETING, { strict: false });
223
223
  await this._step;
224
224
  const execution = this._execution;
225
225
  for (let alive = true; alive;) {
package/lib/esm/index.mjs CHANGED
@@ -144,7 +144,7 @@ class AtomicTask {
144
144
  async cancel() {
145
145
  if (this.status.terminated)
146
146
  return;
147
- this.status.next(TaskStatusEnum.ATTEMPT_CANCELING);
147
+ this.status.next(TaskStatusEnum.ATTEMPT_CANCELING, { strict: false });
148
148
  await this._promise;
149
149
  this.status.next(TaskStatusEnum.CANCELLED, { strict: false });
150
150
  }
@@ -154,7 +154,7 @@ class AtomicTask {
154
154
  await this.start();
155
155
  if (status.terminated)
156
156
  return;
157
- status.next(TaskStatusEnum.ATTEMPT_COMPLETING);
157
+ status.next(TaskStatusEnum.ATTEMPT_COMPLETING, { strict: false });
158
158
  await this._promise;
159
159
  status.next(TaskStatusEnum.COMPLETED, { strict: false });
160
160
  }
@@ -207,7 +207,7 @@ class ResumableTask {
207
207
  async cancel() {
208
208
  if (this.status.terminated)
209
209
  return;
210
- this.status.next(TaskStatusEnum.ATTEMPT_CANCELING);
210
+ this.status.next(TaskStatusEnum.ATTEMPT_CANCELING, { strict: false });
211
211
  await this._step;
212
212
  this.status.next(TaskStatusEnum.CANCELLED, { strict: false });
213
213
  }
@@ -217,7 +217,7 @@ class ResumableTask {
217
217
  await this.start();
218
218
  if (status.terminated)
219
219
  return;
220
- status.next(TaskStatusEnum.ATTEMPT_COMPLETING);
220
+ status.next(TaskStatusEnum.ATTEMPT_COMPLETING, { strict: false });
221
221
  await this._step;
222
222
  const execution = this._execution;
223
223
  for (let alive = true; alive;) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanghechen/task",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Atomic and resumable tasks",
5
5
  "author": {
6
6
  "name": "guanghechen",