Skip to content
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

Merged
merged 3 commits into from
Jul 3, 2020
Merged

Fix comparing milleseconds to seconds #45

merged 3 commits into from
Jul 3, 2020

Conversation

adam-aws
Copy link
Contributor

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.

@aws-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: e1bc710
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

…rtbeats or its been more than 2X heartbeatIntervalSeconds
@aws-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: b068aab
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@adam-aws adam-aws requested a review from robin-aws June 30, 2020 19:22
.addAttributesEntry(AmazonSQSIdleQueueDeletingClient.IDLE_QUEUE_RETENTION_PERIOD, "60");
queueUrl = client.createQueue(createQueueRequest).getQueueUrl();

SendMessageRequest send_msg_request = new SendMessageRequest()
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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-sqs-awslabs-ci
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: Java-Temporary-Client-CI
  • Commit ID: 0690d0d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@robin-aws robin-aws merged commit 94cdda4 into awslabs:master Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants