@hatchet-dev/typescript-sdk 0.15.0 → 0.15.1-alpha0
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.
|
@@ -11,7 +11,6 @@ export declare class Streamable {
|
|
|
11
11
|
export declare class GrpcPooledListener {
|
|
12
12
|
listener: AsyncIterable<WorkflowRunEvent> | undefined;
|
|
13
13
|
requestEmitter: EventEmitter<[never]>;
|
|
14
|
-
signal: AbortController;
|
|
15
14
|
client: ListenerClient;
|
|
16
15
|
subscribers: Record<string, Streamable>;
|
|
17
16
|
onFinish: () => void;
|
|
@@ -38,7 +38,7 @@ const events_1 = require("events");
|
|
|
38
38
|
const dispatcher_1 = require("../../protoc/dispatcher");
|
|
39
39
|
const abort_controller_x_1 = require("abort-controller-x");
|
|
40
40
|
const sleep_1 = __importDefault(require("../../util/sleep"));
|
|
41
|
-
const DEFAULT_EVENT_LISTENER_RETRY_INTERVAL = 5; // seconds
|
|
41
|
+
const DEFAULT_EVENT_LISTENER_RETRY_INTERVAL = 0.5; // seconds
|
|
42
42
|
const DEFAULT_EVENT_LISTENER_RETRY_COUNT = 20;
|
|
43
43
|
class Streamable {
|
|
44
44
|
constructor(listener, id) {
|
|
@@ -61,7 +61,6 @@ exports.Streamable = Streamable;
|
|
|
61
61
|
class GrpcPooledListener {
|
|
62
62
|
constructor(client, onFinish) {
|
|
63
63
|
this.requestEmitter = new events_1.EventEmitter();
|
|
64
|
-
this.signal = new AbortController();
|
|
65
64
|
this.subscribers = {};
|
|
66
65
|
this.onFinish = () => { };
|
|
67
66
|
this.client = client;
|
|
@@ -79,9 +78,7 @@ class GrpcPooledListener {
|
|
|
79
78
|
}
|
|
80
79
|
try {
|
|
81
80
|
this.client.logger.debug('Initializing child-listener');
|
|
82
|
-
this.listener = this.client.client.subscribeToWorkflowRuns(this.request(), {
|
|
83
|
-
signal: this.signal.signal,
|
|
84
|
-
});
|
|
81
|
+
this.listener = this.client.client.subscribeToWorkflowRuns(this.request(), {});
|
|
85
82
|
if (retries > 0)
|
|
86
83
|
setTimeout(() => this.replayRequests(), 100);
|
|
87
84
|
try {
|
|
@@ -97,8 +94,7 @@ class GrpcPooledListener {
|
|
|
97
94
|
if (Object.keys(this.subscribers).length === 0) {
|
|
98
95
|
// FIXME it would be better to cleanup on parent complete
|
|
99
96
|
this.client.logger.debug('All subscriptions finished, cleaning up listener');
|
|
100
|
-
|
|
101
|
-
this.onFinish();
|
|
97
|
+
break;
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
}
|
|
@@ -113,13 +109,14 @@ class GrpcPooledListener {
|
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
111
|
catch (e) {
|
|
116
|
-
if ((0, abort_controller_x_1.isAbortError)(e)) {
|
|
117
|
-
this.client.logger.
|
|
112
|
+
if (!(0, abort_controller_x_1.isAbortError)(e)) {
|
|
113
|
+
this.client.logger.error(`Error in child-listener: ${e.message}`);
|
|
114
|
+
this.init(retries + 1);
|
|
118
115
|
return;
|
|
119
116
|
}
|
|
120
|
-
this.client.logger.
|
|
121
|
-
this.init(retries + 1);
|
|
117
|
+
this.client.logger.debug('Child Listener aborted');
|
|
122
118
|
}
|
|
119
|
+
this.onFinish();
|
|
123
120
|
});
|
|
124
121
|
}
|
|
125
122
|
subscribe(request) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/typescript-sdk",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1-alpha0",
|
|
4
4
|
"description": "Background task orchestration & visibility for developers",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"api": "npm run exec -- ./src/examples/api.ts",
|
|
59
59
|
"prepublish": "cp package.json dist/package.json;",
|
|
60
60
|
"publish:ci": "rm -rf ./dist && npm run tsc:build && npm run prepublish && cd dist && npm publish --access public --no-git-checks",
|
|
61
|
+
"publish:ci:alpha": "rm -rf ./dist && npm run tsc:build && npm run prepublish && cd dist && npm publish --access public --no-git-checks --tag alpha",
|
|
61
62
|
"generate-docs": "typedoc"
|
|
62
63
|
},
|
|
63
64
|
"keywords": [],
|