Skip to content

Commit

Permalink
fix(workflows/video): check if workflow ids exists before cancelling …
Browse files Browse the repository at this point in the history
…workflow
  • Loading branch information
Zibbp committed Mar 20, 2024
1 parent 599e7dd commit 9c93341
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 0 additions & 5 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ func Run() error {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}

//store, err := database.NewDatabase()
//if err != nil {
// log.Error().Err(err).Msg("failed to create database connection")
// return err
//}
database.InitializeDatabase(false)
store := database.DB()

Expand Down
12 changes: 7 additions & 5 deletions internal/workflows/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ func cancelWorkflowAndCleanup(ctx context.Context, input dto.ArchiveVideoInput)
log.Error().Err(err).Msg("error getting queue item")
return err
}
log.Debug().Msgf("cancelling workflow: %s run: %s", q.WorkflowID, q.WorkflowRunID)
// cancel workflow
err = ganymedeTemporal.GetTemporalClient().Client.TerminateWorkflow(ctx, q.WorkflowID, q.WorkflowRunID, "no stream found")
if err != nil {
log.Error().Err(err).Msg("error cancelling workflow")
return err
if q.WorkflowID != "" && q.WorkflowRunID != "" {
log.Debug().Msgf("cancelling workflow: %s run: %s", q.WorkflowID, q.WorkflowRunID)
err = ganymedeTemporal.GetTemporalClient().Client.TerminateWorkflow(ctx, q.WorkflowID, q.WorkflowRunID, "no stream found")
if err != nil {
log.Error().Err(err).Msg("error cancelling workflow")
return err
}
}
// delete directory
path := fmt.Sprintf("/vods/%s/%s", input.Channel.Name, input.Vod.FolderName)
Expand Down

0 comments on commit 9c93341

Please sign in to comment.