Skip to content

Commit

Permalink
feat(storage): add retry config to notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennaEpp committed Dec 16, 2021
1 parent a4ffb1b commit 6eef4d9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions storage/notifications.go
Expand Up @@ -137,7 +137,12 @@ func (b *BucketHandle) AddNotification(ctx context.Context, n *Notification) (re
if b.userProject != "" {
call.UserProject(b.userProject)
}
rn, err := call.Context(ctx).Do()

var rn *raw.Notification
err = run(ctx, func() error {
rn, err = call.Context(ctx).Do()
return err
}, b.retry, false)
if err != nil {
return nil, err
}
Expand All @@ -156,10 +161,10 @@ func (b *BucketHandle) Notifications(ctx context.Context) (n map[string]*Notific
call.UserProject(b.userProject)
}
var res *raw.Notifications
err = runWithRetry(ctx, func() error {
err = run(ctx, func() error {
res, err = call.Context(ctx).Do()
return err
})
}, b.retry, true)
if err != nil {
return nil, err
}
Expand All @@ -184,7 +189,7 @@ func (b *BucketHandle) DeleteNotification(ctx context.Context, id string) (err e
if b.userProject != "" {
call.UserProject(b.userProject)
}
return runWithRetry(ctx, func() error {
return run(ctx, func() error {
return call.Context(ctx).Do()
})
}, b.retry, true)
}

0 comments on commit 6eef4d9

Please sign in to comment.