Fix for negative durations #1252

Merged
merged 2 commits into from Aug 30, 2016

Conversation

Projects
None yet
2 participants
@ssalinas
Member

ssalinas commented Aug 26, 2016

A few of these have been reported now. There is no reason Singularity should be crashing for this. Make sure the values are non-negative in these two cases.
/fixes #1174 #1251

@ssalinas ssalinas added the hs_staging label Aug 26, 2016

@@ -149,7 +149,7 @@ private void checkDeploy(final SingularityPendingDeploy pendingDeploy, final Lis
SingularityDeployResult deployResult =
getDeployResult(request, cancelRequest, pendingDeploy, updatePendingDeployRequest, deployKey, deploy, deployMatchingTasks, allOtherMatchingTasks, inactiveDeployMatchingTasks);
- LOG.info("Deploy {} had result {} after {}", pendingDeployMarker, deployResult, JavaUtils.durationFromMillis(System.currentTimeMillis() - pendingDeployMarker.getTimestamp()));
+ LOG.info("Deploy {} had result {} after {}", pendingDeployMarker, deployResult, JavaUtils.durationFromMillis(Math.max(System.currentTimeMillis() - pendingDeployMarker.getTimestamp(), 0)));

This comment has been minimized.

@tpetr

tpetr Aug 29, 2016

Member

thoughts on moving Math.max() into durationFromMillis()?

@tpetr

tpetr Aug 29, 2016

Member

thoughts on moving Math.max() into durationFromMillis()?

This comment has been minimized.

@ssalinas

ssalinas Aug 29, 2016

Member

yeah that probably makes sense, I can move it

@ssalinas

ssalinas Aug 29, 2016

Member

yeah that probably makes sense, I can move it

This comment has been minimized.

@ssalinas

ssalinas Aug 29, 2016

Member

updated

@ssalinas

ssalinas Aug 29, 2016

Member

updated

@ssalinas ssalinas merged commit 56924f9 into master Aug 30, 2016

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@ssalinas ssalinas deleted the duration_millis branch Aug 30, 2016

@ssalinas ssalinas modified the milestone: 0.11.0 Sep 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment