Skip to content

Commit 36673fd

Browse files
authored
fix(api): release mutex when stopping a node run (#5216)
* fix(api): release mutex when stopping a node run * test: check release mutex on older run first * fix: add missing check has mutex
1 parent 96a798c commit 36673fd

File tree

4 files changed

+505
-212
lines changed

4 files changed

+505
-212
lines changed

engine/api/workflow/dao_node_run.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,13 @@ func LoadNodeRunByID(db gorp.SqlExecutor, id int64, loadOpts LoadRunOptions) (*s
194194
testsField = withLightNodeRunTestsField
195195
}
196196

197-
query := fmt.Sprintf(`select %s %s
198-
from workflow_node_run
199-
where workflow_node_run.id = $1`, nodeRunFields, testsField)
197+
query := fmt.Sprintf(`
198+
SELECT %s %s
199+
FROM workflow_node_run
200+
WHERE workflow_node_run.id = $1
201+
`, nodeRunFields, testsField)
200202
if err := db.SelectOne(&rr, query, id); err != nil {
201-
return nil, sdk.WrapError(err, "Unable to load workflow_node_run node=%d", id)
203+
return nil, sdk.WrapError(err, "unable to load workflow_node_run with id %d", id)
202204
}
203205

204206
r, err := fromDBNodeRun(rr, loadOpts)
@@ -207,23 +209,22 @@ func LoadNodeRunByID(db gorp.SqlExecutor, id int64, loadOpts LoadRunOptions) (*s
207209
}
208210

209211
if loadOpts.WithArtifacts {
210-
arts, errA := loadArtifactByNodeRunID(db, r.ID)
211-
if errA != nil {
212-
return nil, sdk.WrapError(errA, "LoadNodeRunByID>Error loading artifacts for run %d", r.ID)
212+
arts, err := loadArtifactByNodeRunID(db, r.ID)
213+
if err != nil {
214+
return nil, sdk.WrapError(err, "cannot load artifacts for workflow node run %d", r.ID)
213215
}
214216
r.Artifacts = arts
215217
}
216218

217219
if loadOpts.WithStaticFiles {
218-
staticFiles, errS := loadStaticFilesByNodeRunID(db, r.ID)
219-
if errS != nil {
220-
return nil, sdk.WrapError(errS, "LoadNodeRunByID>Error loading static files for run %d", r.ID)
220+
staticFiles, err := loadStaticFilesByNodeRunID(db, r.ID)
221+
if err != nil {
222+
return nil, sdk.WrapError(err, "cannot load static files for workflow node run %d", r.ID)
221223
}
222224
r.StaticFiles = staticFiles
223225
}
224226

225227
return r, nil
226-
227228
}
228229

229230
//insertWorkflowNodeRun insert in table workflow_node_run

0 commit comments

Comments
 (0)