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.
This commit is contained in:
parent
fb1f250a74
commit
e1885bb7cb
@ -109,30 +109,30 @@ func run() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WaitGroup for services to signal when they have shutdown cleanly.
|
// WaitGroup for services to signal when they have shutdown cleanly.
|
||||||
var shutdownWg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
// Start the webapi server.
|
// Start the webapi server.
|
||||||
shutdownWg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
api.Run(ctx)
|
api.Run(ctx)
|
||||||
shutdownWg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Start vspd.
|
// Start vspd.
|
||||||
vspd := vspd.New(cfg.network, log, db, dcrd, wallets, blockNotifChan)
|
vspd := vspd.New(cfg.network, log, db, dcrd, wallets, blockNotifChan)
|
||||||
shutdownWg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
vspd.Run(ctx)
|
vspd.Run(ctx)
|
||||||
shutdownWg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Periodically write a database backup file.
|
// Periodically write a database backup file.
|
||||||
shutdownWg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
shutdownWg.Done()
|
wg.Done()
|
||||||
return
|
return
|
||||||
case <-time.After(cfg.BackupInterval):
|
case <-time.After(cfg.BackupInterval):
|
||||||
err := db.WriteHotBackupFile()
|
err := db.WriteHotBackupFile()
|
||||||
@ -145,7 +145,7 @@ func run() int {
|
|||||||
|
|
||||||
// Wait for shutdown tasks to complete before running deferred tasks and
|
// Wait for shutdown tasks to complete before running deferred tasks and
|
||||||
// returning.
|
// returning.
|
||||||
shutdownWg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user