Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/silver-keys-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@powersync/service-module-mongodb-storage': patch
'@powersync/lib-service-mongodb': patch
'@powersync/service-core': patch
'@powersync/service-image': patch
---

[MongoDB Storage] Increase checksum timeouts
17 changes: 16 additions & 1 deletion libs/lib-mongodb/src/db/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ export const MONGO_CONNECT_TIMEOUT_MS = 10_000;

/**
* Time for individual requests to timeout the socket.
*
* Currently increased to cater for slow checksum calculations - may be reduced to 60s again
* if we optimize those.
*/
export const MONGO_SOCKET_TIMEOUT_MS = 60_000;
export const MONGO_SOCKET_TIMEOUT_MS = 90_000;

/**
* Time for individual requests to timeout the operation.
Expand All @@ -21,6 +24,18 @@ export const MONGO_SOCKET_TIMEOUT_MS = 60_000;
*/
export const MONGO_OPERATION_TIMEOUT_MS = 40_000;

/**
* Time for individual checksums requests to timeout the operation.
*
* This is time spent on the cursor, not total time.
*
* Must be less than MONGO_SOCKET_TIMEOUT_MS to ensure proper error handling.
*
* This is temporarily increased to cater for slow checksum calculations,
* may be reduced to MONGO_OPERATION_TIMEOUT_MS again if we optimize those.
*/
export const MONGO_CHECKSUM_TIMEOUT_MS = 80_000;

/**
* Same as above, but specifically for clear operations.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ export class MongoSyncBucketStorage
}
}
],
{ session: undefined, readConcern: 'snapshot', maxTimeMS: lib_mongo.db.MONGO_OPERATION_TIMEOUT_MS }
{ session: undefined, readConcern: 'snapshot', maxTimeMS: lib_mongo.db.MONGO_CHECKSUM_TIMEOUT_MS }
)
.toArray()
.catch((e) => {
Expand Down