Skip to content

fix(gift): stop streak gifts being dropped and double counted - #160

Open
lulajax wants to merge 1 commit into
jwdeveloper:masterfrom
lulajax:fix/gift-streak-tracking
Open

fix(gift): stop streak gifts being dropped and double counted#160
lulajax wants to merge 1 commit into
jwdeveloper:masterfrom
lulajax:fix/gift-streak-tracking

Conversation

@lulajax

@lulajax lulajax commented Aug 6, 2026

Copy link
Copy Markdown

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant