Skip to content

Commit

Permalink
Prevent unnecessary logging in notification stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Anson-Quek committed Jan 29, 2023
1 parent b414a81 commit a9d12e0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions weverse/weverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ async def _get_new_comment(
try:
artist_comments = await self.fetch_artist_comments(notification.post_id)

except NotFound: # This is because the Post has been deleted.
except (Forbidden, NotFound): # This is because the Post has been deleted.
continue

if not old_cache.get(notification.post_id + notification.author.id):
Expand Down Expand Up @@ -589,7 +589,12 @@ async def __notification_stream(self) -> None:
await self.on_new_notification(notification)

if notification.post_type == NotificationType.POST:
post = await self.fetch_post(notification.post_id)
try:
post = await self.fetch_post(notification.post_id)

except Forbidden:
continue

await self.on_new_post(post)

elif notification.post_type == NotificationType.MOMENT:
Expand All @@ -606,7 +611,12 @@ async def __notification_stream(self) -> None:
await self.on_new_media(media)

elif notification.post_type == NotificationType.LIVE:
live = await self.fetch_live(notification.post_id)
try:
live = await self.fetch_live(notification.post_id)

except Forbidden:
continue

await self.on_new_live(live)

elif notification.post_type == NotificationType.NOTICE:
Expand Down

0 comments on commit a9d12e0

Please sign in to comment.