@hatchet-dev/typescript-sdk 1.35.0 → 1.35.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.
@@ -225,8 +225,6 @@ class ActionListener {
225
225
  }
226
226
  });
227
227
  }
228
- // Leaves the heartbeat running: tasks that are already in flight still need
229
- // the engine to see this worker as alive until they finish.
230
228
  stopStream() {
231
229
  this.done = true;
232
230
  // Abort the gRPC stream to immediately cancel the generator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.35.0",
3
+ "version": "1.35.1",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -639,7 +639,7 @@ class InternalWorker {
639
639
  }
640
640
  shutdown() {
641
641
  return __awaiter(this, void 0, void 0, function* () {
642
- var _a, _b;
642
+ var _a;
643
643
  this.killing = true;
644
644
  this.setStatus(health_server_1.workerStatus.UNHEALTHY);
645
645
  this.logger.info('Starting to exit...');
@@ -670,15 +670,17 @@ class InternalWorker {
670
670
  catch (e) {
671
671
  this.logger.error(`Could not stop durable listener: ${e.message}`);
672
672
  }
673
- (_a = this.listener) === null || _a === void 0 ? void 0 : _a.stopStream();
674
673
  this.logger.info('Gracefully exiting hatchet worker, running tasks will attempt to finish...');
675
- // attempt to wait for futures to finish
676
- yield Promise.all(Object.values(this.futures).map(({ promise }) => promise));
674
+ // Awaits the underlying work rather than the cancelable wrapper, which rejects as soon as a
675
+ // cancellation arrives while the task is still winding down.
676
+ yield Promise.allSettled(Object.values(this.futures).map(({ inner }) => inner));
677
677
  this.logger.info('Successfully finished pending tasks.');
678
- // Unregistering stops the heartbeat, so it has to wait until the running tasks are done:
679
- // otherwise the engine sees a dead worker and reassigns tasks that are about to complete.
678
+ // Unregistering closes the action stream and stops the heartbeat, so it has to wait until
679
+ // the running tasks are done. Stopping the heartbeat earlier lets the engine treat the worker
680
+ // as dead and reassign tasks that are about to complete, and closing the stream earlier makes
681
+ // the engine reject every heartbeat sent while those tasks finish.
680
682
  try {
681
- yield ((_b = this.listener) === null || _b === void 0 ? void 0 : _b.unregister());
683
+ yield ((_a = this.listener) === null || _a === void 0 ? void 0 : _a.unregister());
682
684
  }
683
685
  catch (e) {
684
686
  this.logger.error(`Could not unregister listener: ${e.message}`);
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "1.35.0";
1
+ export declare const HATCHET_VERSION = "1.35.1";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '1.35.0';
4
+ exports.HATCHET_VERSION = '1.35.1';