@lobu/embeddings 14.12.0 → 14.14.0
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.
- package/dist/server.js +15 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -152,6 +152,21 @@ app.post("/api/embeddings", async (c) => {
|
|
|
152
152
|
return c.json({ error: message }, 500);
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
|
+
// When forked by the embedded runtime (startEmbeddings), exit if the parent
|
|
156
|
+
// dies without a graceful teardown — otherwise the child is orphaned and leaks
|
|
157
|
+
// until killed by hand. Standalone `npm start` has no IPC channel, so
|
|
158
|
+
// process.send is undefined and this never fires. Same pattern as
|
|
159
|
+
// connector-worker child-runner.ts installParentDeathHandlers().
|
|
160
|
+
//
|
|
161
|
+
// Register the listener BEFORE checking process.connected: Node does not
|
|
162
|
+
// replay a 'disconnect' emitted before a listener exists, and the parent can
|
|
163
|
+
// die mid-module-load (imports run before this line). Register-then-check is
|
|
164
|
+
// gap-free — no event can be processed between two synchronous statements.
|
|
165
|
+
if (process.send) {
|
|
166
|
+
process.on("disconnect", () => process.exit(143));
|
|
167
|
+
if (!process.connected)
|
|
168
|
+
process.exit(143);
|
|
169
|
+
}
|
|
155
170
|
const port = Number.parseInt(process.env.PORT || String(DEFAULT_PORT), 10);
|
|
156
171
|
serve({
|
|
157
172
|
fetch: app.fetch,
|