RocketChat / RocketChat/Rocket.Chat
Scheduled push notification is not sent immediately when user switches from online to away/offline
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
New push notification scheduling behavior introduced by https://github.com/RocketChat/Rocket.Chat/pull/17357 (@rodrigok) and https://github.com/RocketChat/Rocket.Chat/pull/17907 (@sampaiodiego) is really awesome! But when user switches from (inaccurate) online to away/offline, push notification still waits for 120 seconds to expire. It needs to be sent immediately (from https://github.com/RocketChat/Rocket.Chat/pull/17357#issuecomment-700913433).
Steps to reproduce:
- Android app is online/foreground
- Kill the app or switch to another app
- Make sure that user's
statusConnectionis stillonline(this is another issue probably for Rocket.Chat.ReactNative how this sometimes can happen, but it does happen and quite easy to reproduce by just using the phone's task killer)- Reproducible easily using Samsung A50
- I also tried using Realme X2 Pro and it's very hard to kill the app without making the app's status go
offline. But this works: open Rocket.Chat for Android, turn on airplane mode, kill the app, turn off airplane mode, now Rocket.Chat server user'sstatusConnectionis stillonline.
- Server has a posted message, and since user
statusConnectionisonlineaccording to server, meaning push is scheduled in 120 seconds - Before message is received by app, and before 120 seconds timed out, user
statusConnectionis now eitherofflineoraway.
Expected behavior:
When a user's statusConnection becomes offline/away, server sends all delayed push notifications immediately.
Actual behavior:
Server still waits all delayed push notifications, even when a user's statusConnection becomes offline/away.
Server Setup Information:
- Version of Rocket.Chat Server: 3.7.0
- Operating System: Ubuntu 20.04.1
- Deployment Method: GitHub
3.7.0branch - Number of Running Instances: 1
- DB Replicaset Oplog:
local - NodeJS Version:
{
'Rocket.Chat': '3.7.0',
npm: '6.14.8',
ares: '1.16.0',
brotli: '1.0.7',
cldr: '37.0',
http_parser: '2.9.3',
icu: '67.1',
llhttp: '2.1.2',
modules: '72',
napi: '6',
nghttp2: '1.41.0',
node: '12.18.4',
openssl: '1.1.1g',
tz: '2019c',
unicode: '13.0',
uv: '1.38.0',
v8: '7.8.279.23-node.39',
zlib: '1.2.11'
}
- MongoDB Version: 4.2.9
Client Setup Information
- Desktop App or Browser Version: 4.10.0
- Operating System: Android 10
Additional context
I'd like to contribute a fix, but I need some guidance of what files/functions are relevant
- when switching user's statusConnection
- how to call NotificationQueue so that all pending notifications for a user are sent immediately
Relevant logs:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing where a user's statusConnection changes to away or offline, then inspect how NotificationQueue holds delayed push notifications. Reproduce the Android and server sequence described in the issue; done means all pending delayed notifications are sent immediately when the status changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100