fix(typedsocket): initialize correlation ids for requests without pre-existing correlation metadata

This commit is contained in:
2026-05-08 10:17:19 +00:00
parent 56be583403
commit bf83f2d9be
5 changed files with 41 additions and 3 deletions
+8 -2
View File
@@ -383,13 +383,19 @@ export class TypedSocket {
throw new Error('WebSocket not connected');
}
request.correlation ||= {
id: plugins.smartstring.create.createCryptoRandomString(),
phase: 'request',
};
const correlationId = request.correlation.id;
return new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
this.pendingRequests.delete(request.correlation.id);
this.pendingRequests.delete(correlationId);
reject(new Error('Request timeout'));
}, 30000);
this.pendingRequests.set(request.correlation.id, {
this.pendingRequests.set(correlationId, {
resolve: (response) => {
clearTimeout(timeout);
resolve(response);