Skip to content

Commit

Permalink
- Fix asynchronous notification engine task
Browse files Browse the repository at this point in the history
(cherry picked from commit 79274eb)
  • Loading branch information
afabiani committed Nov 21, 2020
1 parent 8d9118f commit 10ca45b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions geonode/tasks/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,17 @@ def send_queued_notifications(self, *args):
advantage of this.
"""
try:
from notification.engine import send_all
except ImportError:
return

# Make sure application can write to location where lock files are stored
if not args and getattr(settings, 'NOTIFICATION_LOCK_LOCATION', None):
send_all(settings.NOTIFICATION_LOCK_LOCATION)
else:
send_all(*args)
from importlib import import_module
notifications = getattr(settings, 'NOTIFICATIONS_MODULE', None)

if notifications:
engine = import_module(f"{notifications}.engine")
send_all = getattr(engine, 'send_all')
# Make sure application can write to location where lock files are stored
if not args and getattr(settings, 'NOTIFICATION_LOCK_LOCATION', None):
send_all(settings.NOTIFICATION_LOCK_LOCATION)
else:
send_all(*args)


@app.task(bind=True,
Expand Down

0 comments on commit 10ca45b

Please sign in to comment.