·
1 commit
to master
since this release
fix(gift): stop streak gifts being dropped and double counted (#160) 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 - mark the container-facing constructor @Inject 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. The @Inject is not incidental. Driving the idle window from a test needs a constructor that takes a clock, and the container picks its constructor by reflection over the public ones: exactly one and it is used as is, more than one and it demands the annotation. Adding the clock overload without it leaves the class unregistrable, and since TikTokLiveClientBuilder registers this handler unconditionally, every client would then die in build() before ever connecting. Co-authored-by: lujunjie <lulajax@163.com>