From 79eb5fcd5c46d3026d93f560444953346fcfc783 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Wed, 20 Dec 2023 07:20:22 +0600 Subject: [PATCH] :necktie: Fixed hub use case --- internal/hub/usecase/hub_ucase.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/hub/usecase/hub_ucase.go b/internal/hub/usecase/hub_ucase.go index f5cbb4a..4eeb5c0 100644 --- a/internal/hub/usecase/hub_ucase.go +++ b/internal/hub/usecase/hub_ucase.go @@ -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) }