mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 14:12:07 +02:00
Fix race condition where streamed events could be lost
Events stream in via model_write listener while also being fetched from the database. If the DB fetch completed before all events were persisted, replaceModelsInStore would wipe out events that came in via model_write. Added mergeModelsInStore that adds fetched events without removing existing ones. Applied to HTTP, gRPC, and WebSocket event hooks.
This commit is contained in:
@@ -11,7 +11,9 @@ function makeEvent(
|
||||
id: 'test',
|
||||
model: 'http_response_event',
|
||||
responseId: 'resp',
|
||||
createdAt: Date.now(),
|
||||
workspaceId: 'ws',
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
event: { type, name, value } as HttpResponseEvent['event'],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user