Skip to content

Commit edc6b54

Browse files
committed
prevent multiple cleanup executions
1 parent 65653d8 commit edc6b54

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

platform/dist/file-stream.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ async function downloadToTemporaryFile(response, baseMetadata) {
129129
// Ignore cleanup errors
130130
}
131131
};
132-
stream.on("close", cleanup);
133-
stream.on("end", cleanup);
134-
stream.on("error", cleanup);
132+
stream.once("close", cleanup);
133+
stream.once("end", cleanup);
134+
stream.once("error", cleanup);
135135
return {
136136
stream,
137137
metadata,

platform/lib/file-stream.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ async function downloadToTemporaryFile(response: Response, baseMetadata: Partial
147147
}
148148
};
149149

150-
stream.on("close", cleanup);
151-
stream.on("end", cleanup);
152-
stream.on("error", cleanup);
150+
stream.once("close", cleanup);
151+
stream.once("end", cleanup);
152+
stream.once("error", cleanup);
153153

154154
return {
155155
stream,

0 commit comments

Comments
 (0)