Skip to content

Commit 5713671

Browse files
Merge pull request #79 from tungv/release/v0.10.2
Release/v0.10.2
2 parents f4151de + 8e01447 commit 5713671

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

packages/jerni/jsr.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jerni/jerni-3",
3-
"version": "0.10.1",
3+
"version": "0.10.2",
44
"exports": {
55
".": "./src/createJourney.ts",
66
"./types": "./src/lib/exported_types.ts",
@@ -14,5 +14,10 @@
1414
"./dev-cli/rewriteChecksum": "./src/dev-cli/rewriteChecksum.ts",
1515
"./dev-cli/ensureMarkdownFileExists": "./src/dev-cli/ensureMarkDownFileExists.ts"
1616
},
17-
"exclude": ["src/tests", "src/worker.ts", "src/cli.ts", "src/begin.ts"]
18-
}
17+
"exclude": [
18+
"src/tests",
19+
"src/worker.ts",
20+
"src/cli.ts",
21+
"src/begin.ts"
22+
]
23+
}

packages/jerni/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jerni/jerni-3",
3-
"version": "0.10.1",
3+
"version": "v0.10.2",
44
"type": "module",
55
"main": "src/index.ts",
66
"bin": {
@@ -52,4 +52,4 @@
5252
"@types/ms": "^0.7.34",
5353
"@types/pretty-ms": "^5.0.1"
5454
}
55-
}
55+
}

packages/jerni/src/getEventStream.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ async function* retrieveJourneyCommittedEvents(
157157
signal: AbortSignal,
158158
): AsyncGenerator<EventStreamReturnType, void, unknown> {
159159
signal.throwIfAborted();
160+
161+
const innerController = new AbortController();
162+
signal.addEventListener("abort", () => innerController.abort());
163+
160164
try {
161165
// passing signal to fetch will throw uncatchable error, instead, add the signal to body.pipeThrough
162166
const resp = await fetch(url.toString(), {
@@ -165,6 +169,7 @@ async function* retrieveJourneyCommittedEvents(
165169
"burst-count": String(batchSize),
166170
"last-event-id": String(lastSeenId),
167171
},
172+
signal: innerController.signal,
168173
});
169174

170175
if (!resp.ok) {
@@ -180,7 +185,7 @@ async function* retrieveJourneyCommittedEvents(
180185
connected_at: Date.now(),
181186
};
182187

183-
const stream = resp.body.pipeThrough(new TextDecoderStream(), { signal });
188+
const stream = resp.body.pipeThrough(new TextDecoderStream(), { signal: innerController.signal });
184189

185190
const pending = [] as string[];
186191

@@ -259,6 +264,7 @@ async function* retrieveJourneyCommittedEvents(
259264
}
260265
}
261266
} finally {
267+
innerController.abort();
262268
Bun.gc(true);
263269
}
264270
}

0 commit comments

Comments
 (0)