Skip to content

Commit

Permalink
Fix shutdown timeout override (#12648)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ authored Jul 3, 2023
1 parent a0219c1 commit 5f83f10
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,19 @@ public static int getServerShutdownTimeout(ScopeModel scopeModel) {
return timeout;
}

public static int reCalShutdownTime(int expectedShutdownTime) {
public static int reCalShutdownTime(int expected) {
// already timeout
if (expectedShutdownTime < System.currentTimeMillis()) {
return 1;
}

if (expectedShutdownTime - System.currentTimeMillis() < expectedShutdownTime) {
if (expectedShutdownTime - System.currentTimeMillis() < expected) {
// the shutdown time rest is less than expected
return (int) Math.max(1, expectedShutdownTime - System.currentTimeMillis());
}

return expectedShutdownTime;
// return the expected
return expected;
}

public static void setExpectedShutdownTime(long expectedShutdownTime) {
Expand Down

0 comments on commit 5f83f10

Please sign in to comment.