accounts/keystore: use ticker to avoid timer allocs

Co-authored-by: viktorking7 <140458814+viktorking7@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
This commit is contained in:
viktorking7 2025-09-24 13:46:36 +02:00 committed by lightclient
parent 48c74f4593
commit 9ba425bdd1
No known key found for this signature in database
GPG key ID: 657913021EF45A6A

View file

@ -196,11 +196,14 @@ func (ks *KeyStore) Subscribe(sink chan<- accounts.WalletEvent) event.Subscripti
// forces a manual refresh (only triggers for systems where the filesystem notifier
// is not running).
func (ks *KeyStore) updater() {
ticker := time.NewTicker(walletRefreshCycle)
defer ticker.Stop()
for {
// Wait for an account update or a refresh timeout
select {
case <-ks.changes:
case <-time.After(walletRefreshCycle):
case <-ticker.C:
}
// Run the wallet refresher
ks.refreshWallets()