From cd8b0b0dca8a5dce2c25ec7c48a2cc349529af47 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 26 Oct 2022 19:00:40 -0400 Subject: [PATCH] remove live activity record when oauth revoked --- internal/worker/live_activities.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/worker/live_activities.go b/internal/worker/live_activities.go index cb5c7b8..9f6f635 100644 --- a/internal/worker/live_activities.go +++ b/internal/worker/live_activities.go @@ -187,6 +187,9 @@ func (lac *liveActivitiesConsumer) Consume(delivery rmq.Delivery) { zap.String("reddit#access_token", rac.ObfuscatedAccessToken()), zap.String("reddit#refresh_token", rac.ObfuscatedRefreshToken()), ) + if err == reddit.ErrOauthRevoked { + _ = lac.liveActivityRepo.Delete(lac, at) + } return } @@ -211,6 +214,9 @@ func (lac *liveActivitiesConsumer) Consume(delivery rmq.Delivery) { zap.String("reddit#access_token", rac.ObfuscatedAccessToken()), zap.String("reddit#refresh_token", rac.ObfuscatedRefreshToken()), ) + if err == reddit.ErrOauthRevoked { + _ = lac.liveActivityRepo.Delete(lac, at) + } return }