Skip to content

Commit b1f82f8

Browse files
authored
---
yaml --- r: 5699 b: refs/heads/master c: c73d3b0 h: refs/heads/master i: 5697: 0387022 5695: 67eb9ab
1 parent b5c31e8 commit b1f82f8

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 97f6164476e90f55e117d816d9b96b0eb78f7e4a
2+
refs/heads/master: c73d3b008ae965e64ca6e8a80a5b49b36970ec15
33
refs/heads/travis: dae77e558b884bc1b165155482d76c8e40b0fca4
44
refs/heads/gh-pages: f8ea70cdc599a5d39c2df480280877afb3bef9bd
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/Subscriber.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ public static final class Builder {
432432
private static final Duration MIN_ACK_EXPIRATION_PADDING = Duration.ofMillis(100);
433433
private static final Duration DEFAULT_ACK_EXPIRATION_PADDING = Duration.ofMillis(500);
434434
private static final Duration DEFAULT_MAX_ACK_EXTENSION_PERIOD = Duration.ofMinutes(60);
435+
private static final long DEFAULT_MEMORY_PERCENTAGE = 20;
435436

436437
static final ExecutorProvider DEFAULT_EXECUTOR_PROVIDER =
437438
InstantiatingExecutorProvider.newBuilder()
@@ -447,7 +448,11 @@ public static final class Builder {
447448
Duration ackExpirationPadding = DEFAULT_ACK_EXPIRATION_PADDING;
448449
Duration maxAckExtensionPeriod = DEFAULT_MAX_ACK_EXTENSION_PERIOD;
449450

450-
FlowControlSettings flowControlSettings = FlowControlSettings.getDefaultInstance();
451+
FlowControlSettings flowControlSettings =
452+
FlowControlSettings.newBuilder()
453+
.setMaxOutstandingRequestBytes(
454+
Runtime.getRuntime().maxMemory() * DEFAULT_MEMORY_PERCENTAGE / 100L)
455+
.build();
451456

452457
ExecutorProvider executorProvider = DEFAULT_EXECUTOR_PROVIDER;
453458
@Nullable ExecutorProvider alarmsExecutorProvider;

0 commit comments

Comments
 (0)