-
Notifications
You must be signed in to change notification settings - Fork 183
Ursa 21.14.0 plat 25213 #13265
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
base: Venus-22.0.0
Are you sure you want to change the base?
Ursa 21.14.0 plat 25213 #13265
Conversation
plugins/scheduled_task/batch/ScheduledTaskRunner/KScheduledTaskRunner.class.php
Outdated
Show resolved
Hide resolved
plugins/scheduled_task/batch/ScheduledTaskRunner/KScheduledTaskRunner.class.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new scheduling function in the scheduled task runner to index tasks per partner and adds a safety check in the generic scheduler to ensure indexes are iterated only when in array format.
- Added getMrIndexPerPartner() to compute a task index based on partnerId for scheduling.
- Inserted a logging statement for debugging task execution and included an explicit guard for non-array index values in the scheduler.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
plugins/scheduled_task/batch/ScheduledTaskRunner/KScheduledTaskRunner.class.php | Introduces helper method to calculate the partner-specific task index and adds logging in run() |
batch/scheduler/KGenericScheduler.class.php | Wraps the non-array check for task indexes in braces for clarity |
$mrNumberOfWorkers = $this->getParams('mrNumberOfWorkers'); | ||
if($mrNumberOfWorkers) | ||
{ | ||
$index = ($partnerId / 10) % $mrNumberOfWorkers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider explicitly casting ($partnerId / 10) to an integer before applying the modulo to ensure the arithmetic behaves as expected, since PHP division returns a float.
$index = ($partnerId / 10) % $mrNumberOfWorkers; | |
$index = (int)($partnerId / 10) % $mrNumberOfWorkers; |
Copilot uses AI. Check for mistakes.
No description provided.