Skip to content

Commit d65b5bb

Browse files
fix: increase timeout for subscriptions to be established on slow networks (#1389)
1 parent 30029b6 commit d65b5bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/SubscriptionProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
*/
6767
final class SubscriptionProcessor {
6868
private static final Logger LOG = Amplify.Logging.forNamespace("amplify:aws-datastore");
69-
private static final long TIMEOUT_SECONDS_PER_MODEL = 2;
70-
private static final long NETWORK_OP_TIMEOUT_SECONDS = 10;
69+
private static final long TIMEOUT_SECONDS_PER_MODEL = 20;
70+
private static final long NETWORK_OP_TIMEOUT_SECONDS = 60;
7171

7272
private final AppSync appSync;
7373
private final ModelProvider modelProvider;
@@ -91,8 +91,9 @@ private SubscriptionProcessor(Builder builder) {
9191

9292
this.ongoingOperationsDisposable = new CompositeDisposable();
9393

94-
// Operation times out after 10 seconds. If there are more than 5 models,
95-
// then 2 seconds are added to the timer per additional model count.
94+
// Operation times out after the greater of 60 seconds or 20 seconds per model.
95+
// Previously this was the greater of 10 seconds or 2 seconds per model, but customers
96+
// reported timeouts on 3G connections.
9697
this.adjustedTimeoutSeconds = Math.max(
9798
NETWORK_OP_TIMEOUT_SECONDS,
9899
TIMEOUT_SECONDS_PER_MODEL * modelProvider.modelSchemas().size()

0 commit comments

Comments
 (0)