mardi 29 janvier 2019

optimal method of searching for users for sending reminders via push notifications

I have a use case where I need to remind my app users (both android & ios) each day
for certain activities they have upcoming or which are overdue. The timings of these activities have been defined by users and can change anytime.

Currently I run a node script which keeps scanning my mongoDb database and selects the eligible users and sends the notifications every 15 minutes. Since there are multiple activities and each scanning function takes a bit of time to execute the efficiency of the script is low which keeps on getting worse as my user collections get larger.

Is there a better way than keep scanning the mongo database every 15 minutes?.

solutions tried:

  1. Indexing. It isn't helping much in this case as we already have mutiple indices and the queries being used cover almost all the user fields.
  2. Optimizing the selection query

Aucun commentaire:

Enregistrer un commentaire