Skip to content

Commit

Permalink
Fixed DataSync sometimes not catching Websocket responses
Browse files Browse the repository at this point in the history
When `createRecord` is called, and a `DIdInsert` or similiar message without a `requestId` was received, the call to `.splice` accidentally cleared the `pendingRequests` array. After that responses to pending messages are ignored and certain functionality hangs forever
  • Loading branch information
mpscholten committed Aug 18, 2023
1 parent 4589034 commit 3863375
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/IHP/DataSync/ihp-datasync.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ class DataSyncController {

// Remove request from array, as we don't need it anymore. If we don't remove it we will
// build up a lot of memory and slow down the app over time
this.pendingRequests.splice(this.pendingRequests.indexOf(request), 1);
if (request !== undefined) {
this.pendingRequests.splice(this.pendingRequests.indexOf(request), 1);
}

this.receivedFirstResponse = true;

Expand Down

0 comments on commit 3863375

Please sign in to comment.