-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix comparing milleseconds to seconds #45
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…rtbeats or its been more than 2X heartbeatIntervalSeconds
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
.addAttributesEntry(AmazonSQSIdleQueueDeletingClient.IDLE_QUEUE_RETENTION_PERIOD, "60"); | ||
queueUrl = client.createQueue(createQueueRequest).getQueueUrl(); | ||
|
||
SendMessageRequest send_msg_request = new SendMessageRequest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Java doesn't tend to use snake_case for anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry had taken that from the AWS SDK for Java documentation :)
@@ -297,7 +297,7 @@ private void heartbeatToQueueIfNecessary(String queueUrl) { | |||
QueueMetadata queueMetadata = queues.get(queueUrl); | |||
if (queueMetadata != null) { | |||
Long lastHeartbeat = queueMetadata.heartbeatTimestamp; | |||
if (lastHeartbeat == null || (System.currentTimeMillis() - lastHeartbeat) > 2 * heartbeatIntervalSeconds) { | |||
if (lastHeartbeat != null && (System.currentTimeMillis() - lastHeartbeat) < 2 * heartbeatIntervalSeconds * 1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's actually take out the 2X factor: I don't see a good reason for it, and since this line was broken before anyway it's not going to break anyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed 2X factor
@@ -18,6 +19,9 @@ | |||
import com.amazonaws.services.sqs.util.SQSMessageConsumer; | |||
import com.amazonaws.services.sqs.util.SQSQueueUtils; | |||
|
|||
import static com.amazonaws.services.sqs.AmazonSQSIdleQueueDeletingClient.LAST_HEARTBEAT_TIMESTAMP_TAG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't bother with a static import for a single reference, I think it just introduces an extra step to understand where something is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the static import
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue #40
Description of changes:
Fix comparing milleseconds to seconds
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.