fix(actions): dont run in parallel (#182)

This commit is contained in:
Ludvig Lundgren 2022-03-17 21:10:33 +01:00 committed by GitHub
parent bb9e51f9d3
commit 2c7cbb4c22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,22 +21,19 @@ func (s *service) RunActions(actions []domain.Action, release domain.Release) er
log.Debug().Msgf("process action: %v for '%v'", action.Name, release.TorrentName)
go func(release domain.Release, action domain.Action) {
err := s.runAction(action, release)
if err != nil {
log.Err(err).Stack().Msgf("process action failed: %v for '%v'", action.Name, release.TorrentName)
err := s.runAction(action, release)
if err != nil {
log.Err(err).Stack().Msgf("process action failed: %v for '%v'", action.Name, release.TorrentName)
s.bus.Publish("release:store-action-status", &domain.ReleaseActionStatus{
ReleaseID: release.ID,
Status: domain.ReleasePushStatusErr,
Action: action.Name,
Type: action.Type,
Rejections: []string{err.Error()},
Timestamp: time.Now(),
})
return
}
}(release, action)
s.bus.Publish("release:store-action-status", &domain.ReleaseActionStatus{
ReleaseID: release.ID,
Status: domain.ReleasePushStatusErr,
Action: action.Name,
Type: action.Type,
Rejections: []string{err.Error()},
Timestamp: time.Now(),
})
}
}
// safe to delete tmp file