Skip to content

Commit

Permalink
fix: missing subscription reading
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Mar 8, 2024
1 parent e72340b commit 08bb92e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service/chats/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/awakari/bot-telegram/service/messages"
"github.com/awakari/client-sdk-go/api"
clientAwkApiReader "github.com/awakari/client-sdk-go/api/grpc/reader"
"github.com/awakari/client-sdk-go/api/grpc/subscriptions"
"github.com/awakari/client-sdk-go/model"
"github.com/awakari/client-sdk-go/model/subscription"
"github.com/cenkalti/backoff/v4"
Expand Down Expand Up @@ -189,8 +190,12 @@ func (r *reader) runOnce() (err error) {
err = r.deliverEventsReadLoop(ctx, readerAwk, subDescr)
}
switch {
case errors.Is(err, subscriptions.ErrNotFound):
fallthrough
case errors.Is(err, api.ErrApiDisabled):
fallthrough
case errors.Is(err, clientAwkApiReader.ErrNotFound):
_ = r.tgCtx.Send(fmt.Sprintf("subscription %s doesn't exist, stopping", r.subId))
_ = r.tgCtx.Send(fmt.Sprintf("failed to read by subscription: %s, cause: %s, stopping", err, r.subId))
_ = r.chatStor.UnlinkSubscription(ctx, r.subId)
r.stop = true
err = nil
Expand Down

0 comments on commit 08bb92e

Please sign in to comment.