likyh commented on code in PR #3846:
URL:
https://github.com/apache/incubator-devlake/pull/3846#discussion_r1037982086
##########
services/pipeline.go:
##########
@@ -348,6 +348,32 @@ func NotifyExternal(pipelineId uint64) errors.Error {
// CancelPipeline FIXME ...
func CancelPipeline(pipelineId uint64) errors.Error {
+ // prevent RunPipelineInQueue from consuming pending pipelines
+ cronLocker.Lock()
+ defer cronLocker.Unlock()
+ pipeline := &models.DbPipeline{}
+ err := db.First(pipeline, pipelineId).Error
+ if err != nil {
+ return errors.BadInput.New("pipeline not found")
+ }
+ if pipeline.Status == models.TASK_CREATED || pipeline.Status ==
models.TASK_RERUN {
+ pipeline.Status = models.TASK_CANCELLED
+ result := db.Save(pipeline)
+ if result.Error != nil {
+ println(result.Error.Error())
Review Comment:
delete debug code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]