Gracefully shutdown watched address fill service on interrupt

This commit is contained in:
2022-05-18 11:08:15 +05:30
parent a141d154b7
commit c8bdaefe97
2 changed files with 59 additions and 33 deletions
+7 -2
View File
@@ -101,9 +101,11 @@ func serve() {
logWithCommand.Info("state validator disabled")
}
var watchedAddressFillService *fill.Service
if serverConfig.WatchedAddressGapFillerEnabled {
service := fill.New(serverConfig)
go service.Start()
watchedAddressFillService = fill.New(serverConfig)
wg.Add(1)
go watchedAddressFillService.Start(wg)
logWithCommand.Info("watched address gap filler enabled")
} else {
logWithCommand.Info("watched address gap filler disabled")
@@ -115,6 +117,9 @@ func serve() {
if graphQL != nil {
graphQL.Stop()
}
if watchedAddressFillService != nil {
watchedAddressFillService.Stop()
}
server.Stop()
wg.Wait()
}