mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(releases): max downloads per hour (#883)
* fix(releases): max downloads per hour * refactor: release processing * compare apples to apples (#884) * from rocketships back to apples * Update internal/database/filter.go * cast me to the * keep your eye on the case --------- Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
This commit is contained in:
parent
da5492febb
commit
ef3445cbed
7 changed files with 139 additions and 107 deletions
|
@ -93,18 +93,6 @@ func (s *service) RunAction(ctx context.Context, action *domain.Action, release
|
|||
return rejections, err
|
||||
}
|
||||
|
||||
rlsActionStatus := &domain.ReleaseActionStatus{
|
||||
ReleaseID: release.ID,
|
||||
Status: domain.ReleasePushStatusApproved,
|
||||
Action: action.Name,
|
||||
Type: action.Type,
|
||||
Client: action.Client.Name,
|
||||
Filter: release.Filter.Name,
|
||||
FilterID: int64(release.Filter.ID),
|
||||
Rejections: []string{},
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
|
||||
payload := &domain.NotificationPayload{
|
||||
Event: domain.NotificationEventPushApproved,
|
||||
ReleaseName: release.TorrentName,
|
||||
|
@ -126,26 +114,17 @@ func (s *service) RunAction(ctx context.Context, action *domain.Action, release
|
|||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("process action failed: %v for '%v'", action.Name, release.TorrentName)
|
||||
|
||||
rlsActionStatus.Status = domain.ReleasePushStatusErr
|
||||
rlsActionStatus.Rejections = []string{err.Error()}
|
||||
|
||||
payload.Event = domain.NotificationEventPushError
|
||||
payload.Status = domain.ReleasePushStatusErr
|
||||
payload.Rejections = []string{err.Error()}
|
||||
}
|
||||
|
||||
if rejections != nil {
|
||||
rlsActionStatus.Status = domain.ReleasePushStatusRejected
|
||||
rlsActionStatus.Rejections = rejections
|
||||
|
||||
payload.Event = domain.NotificationEventPushRejected
|
||||
payload.Status = domain.ReleasePushStatusRejected
|
||||
payload.Rejections = rejections
|
||||
}
|
||||
|
||||
// send event for actions
|
||||
s.bus.Publish("release:push", rlsActionStatus)
|
||||
|
||||
// send separate event for notifications
|
||||
s.bus.Publish("events:notification", &payload.Event, payload)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue