From e1885bb7cbbddda3222b8b70aa71ce91805030ca Mon Sep 17 00:00:00 2001 From: jholdstock Date: Wed, 20 Sep 2023 09:41:06 +0100 Subject: [PATCH] multi: Rename shutdownWg to wg. The more verbose name was helpful in the past when some code was handling more than one waitgroup, however that is no longer the case due to refactoring so reverting to the more concise name makes sense. --- cmd/vspd/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/vspd/main.go b/cmd/vspd/main.go index dd34d03..43033e0 100644 --- a/cmd/vspd/main.go +++ b/cmd/vspd/main.go @@ -109,30 +109,30 @@ func run() int { } // WaitGroup for services to signal when they have shutdown cleanly. - var shutdownWg sync.WaitGroup + var wg sync.WaitGroup // Start the webapi server. - shutdownWg.Add(1) + wg.Add(1) go func() { api.Run(ctx) - shutdownWg.Done() + wg.Done() }() // Start vspd. vspd := vspd.New(cfg.network, log, db, dcrd, wallets, blockNotifChan) - shutdownWg.Add(1) + wg.Add(1) go func() { vspd.Run(ctx) - shutdownWg.Done() + wg.Done() }() // Periodically write a database backup file. - shutdownWg.Add(1) + wg.Add(1) go func() { for { select { case <-ctx.Done(): - shutdownWg.Done() + wg.Done() return case <-time.After(cfg.BackupInterval): err := db.WriteHotBackupFile() @@ -145,7 +145,7 @@ func run() int { // Wait for shutdown tasks to complete before running deferred tasks and // returning. - shutdownWg.Wait() + wg.Wait() return 0 }