@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
|
@@ -639,7 +639,7 @@ class InternalWorker {
|
|
|
639
639
|
}
|
|
640
640
|
shutdown() {
|
|
641
641
|
return __awaiter(this, void 0, void 0, function* () {
|
|
642
|
-
var _a
|
|
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
|
-
//
|
|
676
|
-
|
|
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
|
|
679
|
-
//
|
|
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 ((
|
|
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.
|
|
1
|
+
export declare const HATCHET_VERSION = "1.35.1";
|
package/version.js
CHANGED