Skip to content

Subathon timer fails to add multiple subs correctly #5

Open
@ChibiAcer

Description

@ChibiAcer

There seems to be an issue where the subathon timer widget fails to correctly add time when multiple subs are gifted at once. If it's set to add 1 minute per sub, when someone gifts 5 at once, sometimes it only adds 1 or 2 minutes to the timer.

Reviewing the footage, I've seen instances where the time is being added, it suddenly goes back down, then adds again. I suspect the problem is that when multiple subs come in simultaneously they're overwriting each other. The function handle_activityReceived runs async, but when multiple events arrive at once they're not waiting for each other to finish adding to the timer before triggering. So if the timer currently ends at 10:00, multiple triggers will say, "Add 1 minute to 10:00, the time should now be 10:01".

I think the solution is to modify the addTime expressions under subathon/widget-main.js, line 215, 219, and 223.

From:
if (isInt(str) && managedData.timeAdditions.t1[0]) addTime(parseInt(str, 10));
To:
if (isInt(str) && managedData.timeAdditions.t1[0]) await addTime(parseInt(str, 10));

Unfortunately, I'm only a stream moderator, not a streamer, so I'm having difficulty testing the code firsthand. I'm also not heavily practiced with JavaScript and asynchronous code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions