Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][ThrottleMgr] Incorrectly fires based on the number of days past #1979

Closed
MSNev opened this issue Jan 31, 2023 · 1 comment
Closed

[BUG][ThrottleMgr] Incorrectly fires based on the number of days past #1979

MSNev opened this issue Jan 31, 2023 · 1 comment
Assignees
Milestone

Comments

@MSNev
Copy link
Collaborator

MSNev commented Jan 31, 2023

The ThrottleMgr tests is currently failing due to a bug in the canThrottle() method.

When the dayInterval is set to number (currently 31)

The canThrottle() is calculating the dayCheck based on the current date and is not taking the previous date into consideration (like it is doing for the month)

            let curDate = _getThrottleDate();
            let date = localStorageObj.date;
            let interval = config.interval;
            let monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth();
            let monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand);
            let dayCheck = _checkInterval(interval.dayInterval, 0, curDate.getUTCDate()) -1;
            return monthCheck >= 0 && dayCheck >= 0 && dayCheck <= config.interval.maxTimesPerMonth;

I believe it should be calculating the difference between the last day and the current day
curDate.getUTCDate() - date.getUTCDate()

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants