Skip to content

Serialize, save & replay unsent Alerts #177

@nworbnhoj

Description

@nworbnhoj

When an email or push Alert fails, the Alert should be saved and reattempted at later time.

qwikgame/person/models.py

Lines 212 to 224 in 4afefe2

if type in self.notify_email:
alert.pk = None
alert.mode = 'E'
alert.context['to_email'] = self.user.email
if not alert.dispatch():
# alert.save()
logger.warn("Alert discarded - TODO serialize, save & replay unsent Alerts");
if type in self.notify_push:
alert.pk = None
alert.mode = 'P'
if not alert.dispatch():
# alert.save()
logger.warn("Alert discarded - TODO serialize, save & replay unsent Alerts");

Currently Alerts are unable to be saved because the context holds references to objects (Game, Venue etc) that are unable to be serialized to JSON.

One approach would be to include only the pk of these objects and then rejoin them on get from the db

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions