Skip to content

Commit

Permalink
Add check such that we don't send push notifications from worker inst…
Browse files Browse the repository at this point in the history
…ances
  • Loading branch information
adeveloper-wq committed Aug 2, 2024
1 parent 7388805 commit cd7d1a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def send_notification_for_news_article(sender, instance, created, **kwargs):
if not created:
print('News article was updated, skipping notification sending.')
return

# Don't send messages from workers.
if settings.WORKER_MODE:
print('This instance is a worker, skipping notification sending.')
return

# Authenticate with firebase admin serice key.
cred = Certificate(settings.FCM_PUSH_NOTIFICATION_CONF)
Expand Down

0 comments on commit cd7d1a1

Please sign in to comment.