From 673763c6746c2967c2bf0686de7d1f373cf359b2 Mon Sep 17 00:00:00 2001 From: masqrauder <60554948+masqrauder@users.noreply.github.com> Date: Tue, 19 Sep 2023 00:18:50 -0400 Subject: [PATCH] GH-600: Revert scanner changes --- node/src/accountant/scanners/mod.rs | 42 ++--------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/node/src/accountant/scanners/mod.rs b/node/src/accountant/scanners/mod.rs index 917a3a17e..4484e7516 100644 --- a/node/src/accountant/scanners/mod.rs +++ b/node/src/accountant/scanners/mod.rs @@ -111,7 +111,6 @@ where pub struct ScannerCommon { initiated_at_opt: Option, pub payment_thresholds: Rc, - timeout: Duration, } impl ScannerCommon { @@ -119,7 +118,6 @@ impl ScannerCommon { Self { initiated_at_opt: None, payment_thresholds, - timeout: Duration::from_secs(30u64), } } @@ -732,15 +730,8 @@ impl Scanner for ReceivableScanner { response_skeleton_opt: Option, logger: &Logger, ) -> Result { - if let Some(scan_started_at) = self.scan_started_at() { - return match scan_started_at.elapsed() { - Ok(elapsed) if elapsed.as_secs() >= self.common.timeout.as_secs() => { - info!(logger, "Receivables scan timed out"); - self.mark_as_ended(logger); - Err(BeginScanError::NothingToProcess) - } - _ => Err(BeginScanError::ScanAlreadyRunning(scan_started_at)), - }; + if let Some(timestamp) = self.scan_started_at() { + return Err(BeginScanError::ScanAlreadyRunning(timestamp)); } self.mark_as_started(timestamp); info!( @@ -2716,35 +2707,6 @@ mod tests { assert_eq!(result, Err(BeginScanError::ScanAlreadyRunning(now))); } - #[test] - fn receivable_scanner_ends_scan_after_timeout_elapses() { - init_test_logging(); - let test_name = "receivable_scanner_ends_scan_after_timeout_elapses"; - let scan_start_time = SystemTime::now().sub(Duration::from_secs(60u64)); - let receivable_dao = ReceivableDaoMock::new() - .new_delinquencies_result(vec![]) - .paid_delinquencies_result(vec![]); - let earning_wallet = make_wallet("earning"); - let mut receivable_scanner = ReceivableScannerBuilder::new() - .receivable_dao(receivable_dao) - .earning_wallet(earning_wallet.clone()) - .build(); - let _ = receivable_scanner.begin_scan(scan_start_time, None, &Logger::new(test_name)); - receivable_scanner.mark_as_started(scan_start_time); // pretend we started the scan a minute ago - - let result = - receivable_scanner.begin_scan(SystemTime::now(), None, &Logger::new(test_name)); - - let is_scan_running = receivable_scanner.scan_started_at().is_some(); - assert_eq!(is_scan_running, false); - assert_eq!(result, Err(BeginScanError::NothingToProcess)); - TestLogHandler::new().exists_log_containing(&format!( - "INFO: {test_name}: Scanning for receivables to {earning_wallet}" - )); - TestLogHandler::new() - .exists_log_containing(&format!("INFO: {test_name}: Receivables scan timed out")); - } - #[test] fn receivable_scanner_scans_for_delinquencies() { init_test_logging();