Skip to content

Commit

Permalink
perf(aws): configurable termination lifecycle agent poll time (#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzienert committed Mar 5, 2017
1 parent 9229940 commit 2594fa3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
Expand Up @@ -27,6 +27,7 @@ class InstanceTerminationConfigurationProperties {
int maxMessagesPerCycle = 1000
int visibilityTimeout = 30
int waitTimeSeconds = 5
int pollIntervalSeconds = 30

InstanceTerminationConfigurationProperties() {
// default constructor
Expand All @@ -37,12 +38,14 @@ class InstanceTerminationConfigurationProperties {
String topicARN,
int maxMessagesPerCycle,
int visibilityTimeout,
int waitTimeSeconds) {
int waitTimeSeconds,
int pollIntervalSeconds) {
this.accountName = accountName
this.queueARN = queueARN
this.topicARN = topicARN
this.maxMessagesPerCycle = maxMessagesPerCycle
this.visibilityTimeout = visibilityTimeout
this.waitTimeSeconds = waitTimeSeconds
this.pollIntervalSeconds = pollIntervalSeconds
}
}
Expand Up @@ -112,7 +112,7 @@ public String getProviderName() {

@Override
public long getPollIntervalMillis() {
return TimeUnit.SECONDS.toMillis(30);
return TimeUnit.SECONDS.toMillis(properties.getPollIntervalSeconds());
}

@Override
Expand Down
Expand Up @@ -83,7 +83,8 @@ public Collection<Agent> agents() {
.replaceAll(ACCOUNT_ID_TEMPLATE_PATTERN, credentials.getAccountId()),
properties.getMaxMessagesPerCycle(),
properties.getVisibilityTimeout(),
properties.getWaitTimeSeconds()
properties.getWaitTimeSeconds(),
properties.getPollIntervalSeconds()
),
discoverySupport,
registry
Expand Down
Expand Up @@ -43,6 +43,7 @@ class InstanceTerminationLifecycleAgentProviderSpec extends Specification {
'arn:aws:sqs:{{region}}:{{accountId}}:topicName',
-1,
-1,
-1,
-1
)

Expand Down
Expand Up @@ -73,6 +73,7 @@ class InstanceTerminationLifecycleAgentSpec extends Specification {
topicARN.arn,
-1,
-1,
-1,
-1
),
awsEurekaSupportProvider,
Expand Down

0 comments on commit 2594fa3

Please sign in to comment.