feat: add sync_users_tokens_to_raven_cloud to daily maintenance schedule#2076
Merged
nikkothari22 merged 1 commit intodevelopfrom Mar 14, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extension of #2075
Fixed multiple issues which I found with the current notification system. Created fixes on both Raven as well as Raven Cloud(RC). Had to iterate and test fast hence could not write individual PR descriptions. This closes #2036 and potentially other issues that might not have been reported but might be present. But this is just a small gist of the problems I found with the current working and the fixes -
On Raven -
unsubscribedapi was performingfrappe.db.deletewhich did not run the document lifecycle ofRaven Push Tokenswhich consisted ofon_trash. Theon_trashcalled the delete API on RC. This lead to incorrect/stale tokens being present on RC even when they were removed from Raven. This might be causing duplicate notifications on some devices as well because the tokens might still be valid.Solution was to - Group tokens by user before chunking, ensuring all tokens for a given user are always sent in the same API call. This is done after fixing the
import_user_tokenscall on RC.On RC -
import_user_tokenswhich only appended the tokens and we did not have a "SYNC" between RC and Raven. Ideally RC should only consist tokens which are present on Raven client. Had to modify the logic for deleting stale/duplicate tokens on RC and keeping only the correct ones considering that Raven Client is the source of truth.What this PR does?
It basically, adds the same sync_users_tokens_to_raven_cloud in a scheduled job. It will ensure that everyday we have mirror image of RC and raven.