Skip to content

Commit de968f0

Browse files
robsymebentsherman
andauthored
Add null checks in TowerClient onFlowComplete method (#6384)
Add defensive null checking for sender thread and workflowId to prevent NullPointerException when onFlowComplete is called after initialization failures in onFlowCreate or onFlowBegin methods. Signed-off-by: Rob Syme <rob.syme@gmail.com> Co-authored-by: Ben Sherman <bentshermann@gmail.com>
1 parent dd2154c commit de968f0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerClient.groovy

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,17 @@ class TowerClient implements TraceObserverV2 {
402402
// publish runtime reports
403403
reports.publishRuntimeReports()
404404
// wait the submission of pending events
405-
sender.join()
405+
if( sender )
406+
sender.join()
406407
// wait and flush reports content
407408
reports.flowComplete()
408409
// notify the workflow completion
409410
terminated = true
410-
final req = makeCompleteReq(session)
411-
final resp = sendHttpMessage(urlTraceComplete, req, 'PUT')
412-
logHttpResponse(urlTraceComplete, resp)
411+
if( workflowId ) {
412+
final req = makeCompleteReq(session)
413+
final resp = sendHttpMessage(urlTraceComplete, req, 'PUT')
414+
logHttpResponse(urlTraceComplete, resp)
415+
}
413416
}
414417

415418
@Override

0 commit comments

Comments
 (0)