-
Notifications
You must be signed in to change notification settings - Fork 124
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
Yet more fixes #96
Yet more fixes #96
Conversation
…hout preventing finish of onLoad method
…nd need to use getter for initialization
…witch to a save utility
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.
Some minor comments, but from my limited understanding I do not see anything broken here.
@@ -439,7 +442,25 @@ public void doTerm() { | |||
return; | |||
} | |||
final Throwable x = new FlowInterruptedException(Result.ABORTED); | |||
Futures.addCallback(execution.getCurrentExecutions(/* cf. JENKINS-26148 */true), new FutureCallback<List<StepExecution>>() { | |||
FlowExecution exec = getExecution(); | |||
if (exec == null) { // Already dead, just make sure statuses reflect that. |
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.
Seems like this check belongs more in doKill
, but OK.
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.
nah, doKill
need not check - it's GOING TO null it, guaranteed. 😄
} else { // Remove the logs to copy - execution too broken to fetch nodes | ||
logsToCopy.remove(id); | ||
modified = true; | ||
continue; |
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.
I think you mean break
here.
Actually I think you meant to pull the getExecution()
call outside the logsToCopy
loop, just like the original “broken somehow” code just skipped the rest of this method.
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.
Good point, doing an even better version of that.
super.onLoad(); | ||
|
||
if (completed == Boolean.TRUE && result == null) { | ||
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for"+this); |
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.
BTW
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for {0}", this);
(NetBeans at least will offer a code hint for this.)
if (result == null) { | ||
setResult(Result.FAILURE); | ||
} | ||
LOGGER.log(Level.WARNING, "Nulling out FlowExecution due to error in build "+this.getFullDisplayName(), x); |
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.
For log messages, prefer Run.fullName
(or simply Run.toString
~ this
) over Run.fullDisplayName
.
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.
Good catch.
private final class FailOnLoadListener implements GraphListener { | ||
@Override public void onNewHead(FlowNode node) { | ||
if (node instanceof FlowEndNode) { | ||
Thread finishThread = new Thread(new Runnable() { |
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.
Timer.get().schedule(() -> {
synchronized (getLogCopyGuard()) {
finish(((FlowEndNode) node).getResult(), execution != null ? execution.getCauseOfFailure() : null);
}
}, 1, TimeUnit.SECONDS);
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.
Good point -- should have done it that way initially, brain fart there.
Futures.addCallback(execution.getCurrentExecutions(/* cf. JENKINS-26148 */true), new FutureCallback<List<StepExecution>>() { | ||
FlowExecution exec = getExecution(); | ||
if (exec == null) { // Already dead, just make sure statuses reflect that. | ||
synchronized (getLogCopyGuard()) { |
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.
Any possibility of some comments explaining the logic here?
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.
@abayer done!
needs re-review for changes
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.
🐝
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.
With the same caveats.
@@ -721,7 +724,7 @@ private String key() { | |||
super.onLoad(); | |||
|
|||
if (completed == Boolean.TRUE && result == null) { | |||
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for"+this); | |||
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for "+this); |
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.
Better style FWIW:
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for {0}", this);
@svanoort seem to be getting issues now:
|
MMMMM-multifix for (among others)
finish
, the build was never marked completed). Also accounts for some with the 'blocksRestart' and similar.