-
Notifications
You must be signed in to change notification settings - Fork 32
GH-598: Receivables scheduling hot fix #750
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: GH-598
Are you sure you want to change the base?
Conversation
|
|
||
| #[derive(Debug, PartialEq, Eq, Clone, Copy)] | ||
| pub enum PayableSequenceScanner { | ||
| pub enum StartScanFallibleScanner { |
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 renaming it to FallibleScanner.
|
|
||
| pub fn schedule_new_payable_scan(&self, ctx: &mut Context<Accountant>, logger: &Logger) { | ||
| if let ScanTiming::WaitFor(interval) = self.interval_computer.time_until_next_scan() { | ||
| if let ScanTiming::WaitFor(interval) = self.interval_computer.compute_time_to_next_scan() { |
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.
Good!
| impl RescheduleScanOnErrorResolverReal { | ||
| fn resolve_new_payables( | ||
| err: &StartScanError, | ||
| is_externally_triggered: bool, |
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.
I have an idea!
How about StartScanError are of following types:
enum StartScanError {
Automatic(AutomaticError),
Manual(ManualError),
Test
}
enum AutomaticError {
ScanAlreadyRunning {
cross_scan_cause_opt: Option<ScanType>,
started_at: SystemTime,
},
Common(CommonError)
}
enum ManualError {
AutomaticScanConflict,
UnnecessaryRequest { hint_opt: Option<String> },
Common(CommonError)
}
enum CommonError {
NothingToProcess,
NoConsumingWalletFound
}This way, we can get rid of the flag is_externally_triggered and hopefully unreachable!() too if we refactor it further.
| pub fn build_and_provide_addresses(self) -> (PeerActors, PeerActorAddrs) { | ||
| // | ||
| // The addresses may be helpful for setting up the Counter Messages. | ||
| pub fn build_providing_addresses(self) -> (PeerActors, PeerActorAddrs) { |
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.
build_and_provide_addresses was a better name.
| Err(e) => | ||
| // Any error here panics by design, so the return value is unreachable/ignored. | ||
| { | ||
| self.handle_start_scan_error_and_prevent_scan_stall_point( |
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.
This name's huge. Pick one: resolve_scan_error or handle_scan_error_and_reschedule.
utkarshg6
left a comment
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.
Done!
Note
Refactors scan scheduling/rescheduling to use a new unified scanner enum, adds explicit Receivables error handling, renames the interval-computation API, and updates tests and recorder utilities accordingly.
PayableSequenceScannerwith unifiedStartScanFallibleScanner(addsReceivablesvariant) and updateDisplay/From→ScanType.CalledFromNullScanner; stricter unreachable cases.NewPayableScanIntervalComputer.time_until_next_scan→compute_time_to_next_scan; propagate across schedulers, mocks, and callers.ScanForReceivableshandler now delegates tohandle_request_of_scan_for_receivable()returningScanReschedulingAfterEarlyStop; unreachable follow-ups guarded.ReceivedPaymentsnow reschedules the receivable scan via scheduler;handle_request_of_scan_for_receivable()returns a hint and usesStartScanFallibleScanner::Receivableson errors.StartScanFallibleScanner::{New,Retry,Pending,Receivables}.build_and_provide_addresses→build_providing_addresses; update usages.compute_time_to_next_scan_params_*).Written by Cursor Bugbot for commit e2ca807. This will update automatically on new commits. Configure here.