Skip to content

Commit

Permalink
refactor: Update SendNotification function to handle old and new sett…
Browse files Browse the repository at this point in the history
…ings triggers
  • Loading branch information
tikazyq committed Jul 14, 2024
1 parent efabb20 commit e672329
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/grpc/server/task_server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@ func (svr TaskServerV2) SendNotification(ctx context.Context, request *grpc.Requ
return nil, trace.TraceError(err)
}
for _, s := range settings {
switch s.TaskTrigger {
// compatible with old settings
trigger := s.Trigger
if trigger == "" {
trigger = s.TaskTrigger
}

// send notification
switch trigger {
case constants.NotificationTriggerTaskFinish:
if t.Status != constants.TaskStatusPending && t.Status != constants.TaskStatusRunning {
_ = svc.Send(&s, e)
Expand Down

0 comments on commit e672329

Please sign in to comment.