From dd1caf7a48ce440dee5e65e870f3988514d8a1ae Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 28 Nov 2022 15:52:21 -0500 Subject: [PATCH] hotfix(wallet): comment out history timer to fix app hanging on close Fixes #8401 Threads in Nim are very bad and when the app closes, the thread doesn't close until it is done. That means that the 20 minute timer needs to finish before it can be closed. --- .../service/wallet_account/service.nim | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/app_service/service/wallet_account/service.nim b/src/app_service/service/wallet_account/service.nim index f360198160..569ae60728 100644 --- a/src/app_service/service/wallet_account/service.nim +++ b/src/app_service/service/wallet_account/service.nim @@ -695,17 +695,17 @@ QtObject: self.checkRecentHistory(true) proc startFetchingHistoryTimer(self: Service, resetTimeToNow = true) = - if(self.closingApp): + if(self.closingApp or + not singletonInstance.localAccountSensitiveSettings.getIsWalletEnabled() or + self.isHistoryFetchTimerAlreadyRunning): return - if(self.isHistoryFetchTimerAlreadyRunning): - return - - self.isHistoryFetchTimerAlreadyRunning = true - let arg = TimerTaskArg( - tptr: cast[ByteAddress](timerTask), - vptr: cast[ByteAddress](self.vptr), - slot: "onStartHistoryFetchingTimer", - timeoutInMilliseconds: CheckHistoryIntervalInMilliseconds - ) - self.threadpool.start(arg) + # TODO move this to status-go, because the 20 minutes timer leaves the app hanging when trying to leave + # self.isHistoryFetchTimerAlreadyRunning = true + # let arg = TimerTaskArg( + # tptr: cast[ByteAddress](timerTask), + # vptr: cast[ByteAddress](self.vptr), + # slot: "onStartHistoryFetchingTimer", + # timeoutInMilliseconds: CheckHistoryIntervalInMilliseconds + # ) + # self.threadpool.start(arg)