mirror of
https://github.com/christianselig/apollo-backend
synced 2024-12-22 06:15:27 +00:00
handle oauth revoked errors in watchers
This commit is contained in:
parent
e23d47f815
commit
0ca21ffcb4
1 changed files with 20 additions and 1 deletions
|
@ -218,7 +218,17 @@ func (sc *subredditsConsumer) Consume(delivery rmq.Delivery) {
|
|||
zap.String("subreddit#name", subreddit.NormalizedName()),
|
||||
zap.Int("page", page),
|
||||
)
|
||||
continue
|
||||
|
||||
if err == reddit.ErrOauthRevoked {
|
||||
sc.logger.Info("deleting watcher",
|
||||
zap.Int64("subreddit#id", id),
|
||||
zap.String("subreddit#name", subreddit.NormalizedName()),
|
||||
zap.Int64("watcher#id", watcher.ID),
|
||||
)
|
||||
_ = sc.watcherRepo.Delete(ctx, watcher.ID)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
sc.logger.Debug("loaded new posts",
|
||||
|
@ -283,6 +293,15 @@ func (sc *subredditsConsumer) Consume(delivery rmq.Delivery) {
|
|||
zap.Int64("subreddit#id", id),
|
||||
zap.String("subreddit#name", subreddit.NormalizedName()),
|
||||
)
|
||||
|
||||
if err == reddit.ErrOauthRevoked {
|
||||
sc.logger.Info("deleting watcher",
|
||||
zap.Int64("subreddit#id", id),
|
||||
zap.String("subreddit#name", subreddit.NormalizedName()),
|
||||
zap.Int64("watcher#id", watcher.ID),
|
||||
)
|
||||
_ = sc.watcherRepo.Delete(ctx, watcher.ID)
|
||||
}
|
||||
} else {
|
||||
sc.logger.Debug("loaded hot posts",
|
||||
zap.Int64("subreddit#id", id),
|
||||
|
|
Loading…
Reference in a new issue