@relevanceai/sdk 3.0.0-alpha.6 → 3.0.0-rc.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.
package/esm/task/task.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Emitter } from "../emitter.js";
2
2
  import { abortPromise, delay } from "../utils.js";
3
- import { TaskErrorEvent, TaskMessageEvent, TaskUpdateEvent, } from "../event.js";
3
+ import { TaskErrorEvent, TaskMessageEvent, TaskUpdateEvent } from "../event.js";
4
4
  export const resetBackoffDuration = Symbol("resetBackoffDuration");
5
5
  const backoffStartingDuration = 1_000;
6
6
  const backoffMaxDuration = 60_000;
@@ -59,7 +59,7 @@ export class Task extends Emitter {
59
59
  this.subscribed = subscribed; // subscribed ref
60
60
  const isSubscribed = () => !subscribed.signal.aborted;
61
61
  this.backoffDuration = backoffStartingDuration;
62
- const cursor = new Date(0);
62
+ const cursor = new Date();
63
63
  const emitted = new Set();
64
64
  const pending = new Map();
65
65
  void (async () => {
@@ -148,6 +148,7 @@ export class Task extends Emitter {
148
148
  }
149
149
  [resetBackoffDuration]() {
150
150
  this.backoffDuration = backoffStartingDuration;
151
+ this.backoff?.abort();
151
152
  }
152
153
  addEventListener(type, listener, options) {
153
154
  this.#subscribe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relevanceai/sdk",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-rc.1",
4
4
  "license": "MIT",
5
5
  "main": "./script/mod.js",
6
6
  "module": "./esm/mod.js",
@@ -62,7 +62,7 @@ class Task extends emitter_js_1.Emitter {
62
62
  this.subscribed = subscribed; // subscribed ref
63
63
  const isSubscribed = () => !subscribed.signal.aborted;
64
64
  this.backoffDuration = backoffStartingDuration;
65
- const cursor = new Date(0);
65
+ const cursor = new Date();
66
66
  const emitted = new Set();
67
67
  const pending = new Map();
68
68
  void (async () => {
@@ -151,6 +151,7 @@ class Task extends emitter_js_1.Emitter {
151
151
  }
152
152
  [exports.resetBackoffDuration]() {
153
153
  this.backoffDuration = backoffStartingDuration;
154
+ this.backoff?.abort();
154
155
  }
155
156
  addEventListener(type, listener, options) {
156
157
  this.#subscribe();