sst 2.26.4 → 2.26.5
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/cli/local/server.js +8 -4
- package/package.json +1 -1
package/cli/local/server.js
CHANGED
|
@@ -105,7 +105,11 @@ export async function useLocalServer(opts) {
|
|
|
105
105
|
const sockets = new Set();
|
|
106
106
|
let invocations = [];
|
|
107
107
|
function publish(invocation) {
|
|
108
|
-
invocations.
|
|
108
|
+
const index = invocations.findLastIndex((i) => i.id === invocation.id);
|
|
109
|
+
if (index < 0)
|
|
110
|
+
invocations.push(invocation);
|
|
111
|
+
else
|
|
112
|
+
invocations[index] = invocation;
|
|
109
113
|
const json = JSON.stringify({
|
|
110
114
|
type: "invocation",
|
|
111
115
|
properties: [invocation],
|
|
@@ -234,7 +238,7 @@ export async function useLocalServer(opts) {
|
|
|
234
238
|
});
|
|
235
239
|
});
|
|
236
240
|
bus.subscribe("worker.stdout", (evt) => {
|
|
237
|
-
const invocation = invocations.findLast((i) => i.
|
|
241
|
+
const invocation = invocations.findLast((i) => i.id === evt.properties.requestID);
|
|
238
242
|
if (invocation) {
|
|
239
243
|
invocation.logs.push({
|
|
240
244
|
id: Math.random().toString(),
|
|
@@ -254,7 +258,7 @@ export async function useLocalServer(opts) {
|
|
|
254
258
|
});
|
|
255
259
|
});
|
|
256
260
|
bus.subscribe("function.success", (evt) => {
|
|
257
|
-
const invocation = invocations.findLast((i) => i.
|
|
261
|
+
const invocation = invocations.findLast((i) => i.id === evt.properties.requestID);
|
|
258
262
|
if (invocation) {
|
|
259
263
|
invocation.end = Date.now();
|
|
260
264
|
invocation.report = {
|
|
@@ -278,7 +282,7 @@ export async function useLocalServer(opts) {
|
|
|
278
282
|
});
|
|
279
283
|
});
|
|
280
284
|
bus.subscribe("function.error", (evt) => {
|
|
281
|
-
const invocation = invocations.findLast((i) => i.
|
|
285
|
+
const invocation = invocations.findLast((i) => i.id === evt.properties.requestID);
|
|
282
286
|
if (invocation) {
|
|
283
287
|
invocation.errors.push({
|
|
284
288
|
id: invocation.id,
|