RocketChat / RocketChat/Rocket.Chat

How to remove orphan push tokens?

Open
#6,776 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

subj: mobile
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

We see many push tokens in the log as a queue, which could not be delivered and then hold back new push notifications. This is happening e.g. to users, who do not have an Android phone with Google services enabled, and then switch to another device with Google service enabled. They never get a push notifications, even after weeks.

[34mI20170424-16:09:06.164(2) Push: Could not send notification id: "MRQxxxxxxDyoe9PK", Error: Push.send got a faulty query
[34mI20170424-16:09:06.168(2) Push: Send message "user.test" via query { userId: 'fjCWxDLkbf8K95thD' }

As soon as we remove the tokens from "_raix_push_app_tokens" in the Mongo DB, the push notifications are successfully delivered.

We thought about removing all tokens in a cron job each night, but maybe there is a smarter solution? Or give the tokens a TTL.

Rocket.Chat Version: 0.52

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Push.send failure and the _raix_push_app_tokens MongoDB collection described in the report. Determine how undeliverable tokens are handled and define completion as preventing stale tokens from blocking later push notifications, with the behavior verified against the reported device-switch case.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, mongodb
Domain
backend, databases, mobile
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.