Skip to content

Commit 583e665

Browse files
committed
DataSync: Configurable message timeout
1 parent d59a65d commit 583e665

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/IHP/DataSync/ihp-datasync.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class DataSyncController {
5454
// When doing optimistic inserts, we want to optimistically set the `createdAt` field, if the record will have such a field after insert
5555
// For that we need to keep track of all tables that have a `createdAt` field.
5656
this.optimisticCreatedNeedsCreatedAtField = new Set();
57+
58+
// The websocket times out after not receiving a reply for 5 seconds
59+
this.messageTimeout = 5000;
5760
}
5861

5962
async startConnection() {
@@ -174,7 +177,7 @@ class DataSyncController {
174177
this.connection.send(JSON.stringify(payload));
175178

176179
if (!this.pendingRequestTimeout) {
177-
this.pendingRequestTimeout = setTimeout(this.onPendingRequestTimeout.bind(this), 5000);
180+
this.pendingRequestTimeout = setTimeout(this.onPendingRequestTimeout.bind(this), this.messageTimeout);
178181
}
179182
}
180183
});

0 commit comments

Comments
 (0)