refactor: Remove unused code and test related to scheduler state. - #93
Conversation
WalkthroughThis pull request simplifies scheduler state management and cleanup processes. The Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant CleanupLoop
participant DataStore
participant StopToken
Caller ->> CleanupLoop: invoke cleanup_loop()
loop Cleanup Process
CleanupLoop ->> StopToken: check stop condition
alt Continue cleaning
CleanupLoop ->> DataStore: remove dangling data
else Stop condition met
CleanupLoop -->> Caller: exit cleanup_loop
end
end
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| CREATE TABLE IF NOT EXISTS `scheduler_leases` | ||
| ( | ||
| `scheduler_id` BINARY(16) NOT NULL, | ||
| `task_id` BINARY(16) NOT NULL, | ||
| `lease_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| CONSTRAINT `lease_scheduler_id` FOREIGN KEY (`scheduler_id`) REFERENCES `schedulers` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE, | ||
| CONSTRAINT `lease_task_id` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE, | ||
| INDEX (`scheduler_id`) | ||
| ); | ||
|
|
There was a problem hiding this comment.
Is this change unrelated to the PR? There is no mention of it in the description and none of the other changes are related to leases or require a new table (as far as I can tell).
Is it possible to move this to another more relevant PR?
There was a problem hiding this comment.
After looking at #98 I'm pretty sure this table should be removed from this PR and added in that one.
Description
In early design, scheduler has three states: normal, gc and recovery. However, this design has been ditched a long time ago. Now the scheduler does not have any state so it can serves schedule task request all the time, and gc and recovery are performed in another thread. This pr removes the codes and tests related to the scheduler state.
Checklist
breaking change.
Validation performed
Summary by CodeRabbit