File tree Expand file tree Collapse file tree
trunk/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
2- refs/heads/master: 97f6164476e90f55e117d816d9b96b0eb78f7e4a
2+ refs/heads/master: c73d3b008ae965e64ca6e8a80a5b49b36970ec15
33refs/heads/travis: dae77e558b884bc1b165155482d76c8e40b0fca4
44refs/heads/gh-pages: f8ea70cdc599a5d39c2df480280877afb3bef9bd
55refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments