fix(gift): stop streak gifts being dropped and double counted - #160
Open
lulajax wants to merge 1 commit into
Open
fix(gift): stop streak gifts being dropped and double counted#160lulajax wants to merge 1 commit into
lulajax wants to merge 1 commit into
Conversation
Streak state was keyed on the user alone, so two concurrent streaks from the same user overwrote each other. Finishing one streak then called clear() on the whole map, wiping the state of every other user in the room. A repeated finishing frame raised onGift a second time and the gift was counted twice. TikTok resends the finishing frame of a streak under a fresh msgId, sometimes within milliseconds, so the message id alone does not identify it. A streak that never received a finishing frame never raised onGift at all, and the gift was lost entirely. - key streaks on user + gift + group instead of user alone - remove only the finished streak rather than clearing the whole map - ignore finishing frames repeated within 60s of a streak being closed - close streaks left idle for 5 minutes using their last active frame The idle window is measured from the last frame of a streak rather than its start, so a long streak keeps extending it. It is deliberately generous: closing a streak early would split the gift in two and the real finishing frame would then be discarded as a duplicate.
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.
Streak state was keyed on the user alone, so two concurrent streaks from the same user overwrote each other. Finishing one streak then called clear() on the whole map, wiping the state of every other user in the room.
A repeated finishing frame raised onGift a second time and the gift was counted twice. TikTok resends the finishing frame of a streak under a fresh msgId, sometimes within milliseconds, so the message id alone does not identify it.
A streak that never received a finishing frame never raised onGift at all, and the gift was lost entirely.
The idle window is measured from the last frame of a streak rather than its start, so a long streak keeps extending it. It is deliberately generous: closing a streak early would split the gift in two and the real finishing frame would then be discarded as a duplicate.