👔 Fixed hub use case

This commit is contained in:
Maxim Lebedev 2023-12-20 07:20:22 +06:00
parent 8dfa46eb9b
commit 79eb5fcd5c
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,8 @@ func (ucase *hubUseCase) ListenAndServe(ctx context.Context) error {
for j := range subscriptions {
if subscriptions[j].Expired(ts) {
if err = ucase.subscriptions.Delete(ctx, subscriptions[j].SUID()); err != nil {
_, err = ucase.subscriptions.Delete(ctx, subscriptions[j].SUID())
if err != nil {
return fmt.Errorf("cannot remove expired subcription: %w", err)
}
@ -150,7 +151,7 @@ func (ucase *hubUseCase) push(ctx context.Context, s domain.Subscription, t doma
// that the subscription has been deleted, and the hub MAY terminate the
// subscription if it receives that code as a response.
if resp.StatusCode == http.StatusGone {
if err = ucase.subscriptions.Delete(ctx, suid); err != nil {
if _, err = ucase.subscriptions.Delete(ctx, suid); err != nil {
return false, fmt.Errorf("cannot remove deleted subscription: %w", err)
}