From c224226125b939edd6ef8eb7ecf3ccc63a0cdde8 Mon Sep 17 00:00:00 2001
From: Luca Moser <moser.luca@gmail.com>
Date: Tue, 21 Apr 2020 10:47:47 +0200
Subject: [PATCH] removes duplicated 'Shutdown' name in shutdown priority
 consts (#343)

---
 packages/shutdown/order.go                    | 26 +++++++++----------
 plugins/analysis/client/plugin.go             |  2 +-
 plugins/analysis/server/plugin.go             |  2 +-
 .../webinterface/httpserver/plugin.go         |  2 +-
 plugins/autopeering/plugin.go                 |  2 +-
 plugins/database/plugin.go                    |  4 +--
 plugins/fpc/plugin.go                         |  4 +--
 plugins/gossip/plugin.go                      |  2 +-
 plugins/graph/plugin.go                       |  4 +--
 plugins/messagelayer/plugin.go                |  2 +-
 plugins/metrics/plugin.go                     |  2 +-
 plugins/remotelog/plugin.go                   |  2 +-
 plugins/spa/drng_livefeed.go                  |  2 +-
 plugins/spa/livefeed.go                       |  2 +-
 plugins/spa/plugin.go                         |  2 +-
 plugins/webapi/plugin.go                      |  2 +-
 plugins/webapi/spammer/plugin.go              |  2 +-
 17 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/packages/shutdown/order.go b/packages/shutdown/order.go
index c00add7e..957eb152 100644
--- a/packages/shutdown/order.go
+++ b/packages/shutdown/order.go
@@ -1,17 +1,17 @@
 package shutdown
 
 const (
-	ShutdownPriorityDatabase = iota
-	ShutdownPriorityFPC
-	ShutdownPriorityTangle
-	ShutdownPriorityRemoteLog
-	ShutdownPriorityAnalysis
-	ShutdownPriorityMetrics
-	ShutdownPriorityAutopeering
-	ShutdownPriorityGossip
-	ShutdownPriorityWebAPI
-	ShutdownPrioritySPA
-	ShutdownPriorityGraph
-	ShutdownPrioritySpammer
-	ShutdownPriorityBadgerGarbageCollection
+	PriorityDatabase = iota
+	PriorityFPC
+	PriorityTangle
+	PriorityRemoteLog
+	PriorityAnalysis
+	PriorityMetrics
+	PriorityAutopeering
+	PriorityGossip
+	PriorityWebAPI
+	PrioritySPA
+	PriorityGraph
+	PrioritySpammer
+	PriorityBadgerGarbageCollection
 )
diff --git a/plugins/analysis/client/plugin.go b/plugins/analysis/client/plugin.go
index b1344f7e..18c8fa6c 100644
--- a/plugins/analysis/client/plugin.go
+++ b/plugins/analysis/client/plugin.go
@@ -55,7 +55,7 @@ func Run(plugin *node.Plugin) {
 				}
 			}
 		}
-	}, shutdown.ShutdownPriorityAnalysis)
+	}, shutdown.PriorityAnalysis)
 }
 
 func getEventDispatchers(conn *network.ManagedConnection) *EventDispatchers {
diff --git a/plugins/analysis/server/plugin.go b/plugins/analysis/server/plugin.go
index bfd7296d..2f13eb6f 100644
--- a/plugins/analysis/server/plugin.go
+++ b/plugins/analysis/server/plugin.go
@@ -50,7 +50,7 @@ func Run(plugin *node.Plugin) {
 		go server.Listen("0.0.0.0", config.Node.GetInt(CFG_SERVER_PORT))
 		<-shutdownSignal
 		Shutdown()
-	}, shutdown.ShutdownPriorityAnalysis)
+	}, shutdown.PriorityAnalysis)
 }
 
 func Shutdown() {
diff --git a/plugins/analysis/webinterface/httpserver/plugin.go b/plugins/analysis/webinterface/httpserver/plugin.go
index 6141625f..dba2815c 100644
--- a/plugins/analysis/webinterface/httpserver/plugin.go
+++ b/plugins/analysis/webinterface/httpserver/plugin.go
@@ -47,7 +47,7 @@ func Configure() {
 
 func Run() {
 	log.Infof("Starting %s ...", name)
-	if err := daemon.BackgroundWorker(name, start, shutdown.ShutdownPriorityAnalysis); err != nil {
+	if err := daemon.BackgroundWorker(name, start, shutdown.PriorityAnalysis); err != nil {
 		log.Errorf("Error starting as daemon: %s", err)
 	}
 }
diff --git a/plugins/autopeering/plugin.go b/plugins/autopeering/plugin.go
index c8e5003a..e84cac5b 100644
--- a/plugins/autopeering/plugin.go
+++ b/plugins/autopeering/plugin.go
@@ -26,7 +26,7 @@ func configure(*node.Plugin) {
 }
 
 func run(*node.Plugin) {
-	if err := daemon.BackgroundWorker(name, start, shutdown.ShutdownPriorityAutopeering); err != nil {
+	if err := daemon.BackgroundWorker(name, start, shutdown.PriorityAutopeering); err != nil {
 		log.Errorf("Failed to start as daemon: %s", err)
 	}
 }
diff --git a/plugins/database/plugin.go b/plugins/database/plugin.go
index 3762d8f0..c9c279c9 100644
--- a/plugins/database/plugin.go
+++ b/plugins/database/plugin.go
@@ -34,12 +34,12 @@ func run(plugin *node.Plugin) {
 		timeutil.Ticker(func() {
 			database.CleanupBadgerInstance(log)
 		}, 5*time.Minute, shutdownSignal)
-	}, shutdown.ShutdownPriorityBadgerGarbageCollection)
+	}, shutdown.PriorityBadgerGarbageCollection)
 
 	daemon.BackgroundWorker(PLUGIN_NAME, func(shutdownSignal <-chan struct{}) {
 		<-shutdownSignal
 		log.Infof("Syncing database to disk...")
 		database.GetBadgerInstance().Close()
 		log.Infof("Syncing database to disk... done")
-	}, shutdown.ShutdownPriorityDatabase)
+	}, shutdown.PriorityDatabase)
 }
diff --git a/plugins/fpc/plugin.go b/plugins/fpc/plugin.go
index 8d9e55b0..cf57b6f4 100644
--- a/plugins/fpc/plugin.go
+++ b/plugins/fpc/plugin.go
@@ -101,7 +101,7 @@ func run(_ *node.Plugin) {
 		<-shutdownSignal
 		voterServer.Shutdown()
 		log.Info("Stopped vote server")
-	}, shutdown.ShutdownPriorityFPC)
+	}, shutdown.PriorityFPC)
 
 	daemon.BackgroundWorker("FPCRoundsInitiator", func(shutdownSignal <-chan struct{}) {
 		log.Infof("Started FPC round initiator")
@@ -119,7 +119,7 @@ func run(_ *node.Plugin) {
 			}
 		}
 		log.Infof("Stopped FPC round initiator")
-	}, shutdown.ShutdownPriorityFPC)
+	}, shutdown.PriorityFPC)
 }
 
 // PeerOpinionGiver implements the OpinionGiver interface based on a peer.
diff --git a/plugins/gossip/plugin.go b/plugins/gossip/plugin.go
index 37c4f064..408665af 100644
--- a/plugins/gossip/plugin.go
+++ b/plugins/gossip/plugin.go
@@ -27,7 +27,7 @@ func configure(*node.Plugin) {
 }
 
 func run(*node.Plugin) {
-	if err := daemon.BackgroundWorker(name, start, shutdown.ShutdownPriorityGossip); err != nil {
+	if err := daemon.BackgroundWorker(name, start, shutdown.PriorityGossip); err != nil {
 		log.Errorf("Failed to start as daemon: %s", err)
 	}
 }
diff --git a/plugins/graph/plugin.go b/plugins/graph/plugin.go
index f71c4ad6..f36a9c99 100644
--- a/plugins/graph/plugin.go
+++ b/plugins/graph/plugin.go
@@ -108,7 +108,7 @@ func run(*node.Plugin) {
 		messagelayer.Tangle.Events.TransactionAttached.Detach(notifyNewTx)
 		newTxWorkerPool.Stop()
 		log.Info("Stopping Graph[NewTxWorker] ... done")
-	}, shutdown.ShutdownPriorityGraph)
+	}, shutdown.PriorityGraph)
 
 	daemon.BackgroundWorker("Graph Webserver", func(shutdownSignal <-chan struct{}) {
 		go socketioServer.Serve()
@@ -141,5 +141,5 @@ func run(*node.Plugin) {
 			log.Errorf("Error closing Socket.IO server: %s", err)
 		}
 		log.Info("Stopping Graph Webserver ... done")
-	}, shutdown.ShutdownPriorityGraph)
+	}, shutdown.PriorityGraph)
 }
diff --git a/plugins/messagelayer/plugin.go b/plugins/messagelayer/plugin.go
index 7e0ad510..7207b0be 100644
--- a/plugins/messagelayer/plugin.go
+++ b/plugins/messagelayer/plugin.go
@@ -86,5 +86,5 @@ func run(*node.Plugin) {
 		MessageFactory.Shutdown()
 		TransactionParser.Shutdown()
 		Tangle.Shutdown()
-	}, shutdown.ShutdownPriorityTangle)
+	}, shutdown.PriorityTangle)
 }
diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go
index a07160af..2e315eab 100644
--- a/plugins/metrics/plugin.go
+++ b/plugins/metrics/plugin.go
@@ -30,5 +30,5 @@ func run(plugin *node.Plugin) {
 	// create a background worker that "measures" the TPS value every second
 	daemon.BackgroundWorker("Metrics TPS Updater", func(shutdownSignal <-chan struct{}) {
 		timeutil.Ticker(measureReceivedTPS, 1*time.Second, shutdownSignal)
-	}, shutdown.ShutdownPriorityMetrics)
+	}, shutdown.PriorityMetrics)
 }
diff --git a/plugins/remotelog/plugin.go b/plugins/remotelog/plugin.go
index cc241e6c..9622b0af 100644
--- a/plugins/remotelog/plugin.go
+++ b/plugins/remotelog/plugin.go
@@ -96,7 +96,7 @@ func run(plugin *node.Plugin) {
 		logger.Events.AnyMsg.Detach(logEvent)
 		workerPool.Stop()
 		log.Infof("Stopping %s ... done", PLUGIN_NAME)
-	}, shutdown.ShutdownPriorityRemoteLog)
+	}, shutdown.PriorityRemoteLog)
 }
 
 func sendLogMsg(level logger.Level, name string, msg string) {
diff --git a/plugins/spa/drng_livefeed.go b/plugins/spa/drng_livefeed.go
index 5f4b087e..7788dcfb 100644
--- a/plugins/spa/drng_livefeed.go
+++ b/plugins/spa/drng_livefeed.go
@@ -51,5 +51,5 @@ func runDrngLiveFeed() {
 		newMsgRateLimiter.Stop()
 		drngLiveFeedWorkerPool.Stop()
 		log.Info("Stopping SPA[DRNGUpdater] ... done")
-	}, shutdown.ShutdownPrioritySPA)
+	}, shutdown.PrioritySPA)
 }
diff --git a/plugins/spa/livefeed.go b/plugins/spa/livefeed.go
index bf2ab1af..551f0985 100644
--- a/plugins/spa/livefeed.go
+++ b/plugins/spa/livefeed.go
@@ -49,5 +49,5 @@ func runLiveFeed() {
 		newMsgRateLimiter.Stop()
 		liveFeedWorkerPool.Stop()
 		log.Info("Stopping SPA[MsgUpdater] ... done")
-	}, shutdown.ShutdownPrioritySPA)
+	}, shutdown.PrioritySPA)
 }
diff --git a/plugins/spa/plugin.go b/plugins/spa/plugin.go
index e5b76149..f1d3fce4 100644
--- a/plugins/spa/plugin.go
+++ b/plugins/spa/plugin.go
@@ -72,7 +72,7 @@ func run(plugin *node.Plugin) {
 		metrics.Events.ReceivedTPSUpdated.Detach(notifyStatus)
 		wsSendWorkerPool.Stop()
 		log.Info("Stopping SPA[WSSend] ... done")
-	}, shutdown.ShutdownPrioritySPA)
+	}, shutdown.PrioritySPA)
 
 	runLiveFeed()
 	runDrngLiveFeed()
diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go
index 2ebeb7be..1c69ea5d 100644
--- a/plugins/webapi/plugin.go
+++ b/plugins/webapi/plugin.go
@@ -46,5 +46,5 @@ func run(plugin *node.Plugin) {
 		if err := Server.Shutdown(ctx); err != nil {
 			log.Errorf("Couldn't stop server cleanly: %s", err.Error())
 		}
-	}, shutdown.ShutdownPriorityWebAPI)
+	}, shutdown.PriorityWebAPI)
 }
diff --git a/plugins/webapi/spammer/plugin.go b/plugins/webapi/spammer/plugin.go
index b83f0b6e..318d89e6 100644
--- a/plugins/webapi/spammer/plugin.go
+++ b/plugins/webapi/spammer/plugin.go
@@ -26,5 +26,5 @@ func run(*node.Plugin) {
 		<-shutdownSignal
 
 		transactionSpammer.Shutdown()
-	}, shutdown.ShutdownPrioritySpammer)
+	}, shutdown.PrioritySpammer)
 }
-- 
GitLab