From 8d245f372e9f8a84ac721adc6ab1684e51e25eba Mon Sep 17 00:00:00 2001 From: postmannen Date: Fri, 26 Mar 2021 10:25:56 +0100 Subject: [PATCH] flag for sayhello publisher --- configuration_flags.go | 6 +++--- etc/config.toml | 2 +- startup_processes.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configuration_flags.go b/configuration_flags.go index 63269f1..c180f2f 100644 --- a/configuration_flags.go +++ b/configuration_flags.go @@ -91,7 +91,7 @@ type Configuration struct { // default amount of retries that will be done before a message is thrown away, and out of the system DefaultMessageRetries int // Make the current node send hello messages to central at given interval in seconds - PublisherServiceSayhello int + StartPubSayHello int // Publisher data folder SubscribersDataFolder string // central node to receive messages published from nodes @@ -131,7 +131,7 @@ func newConfigurationDefaults() Configuration { PromHostAndPort: "", DefaultMessageTimeout: 10, DefaultMessageRetries: 1, - PublisherServiceSayhello: 30, + StartPubSayHello: 30, SubscribersDataFolder: "./data", CentralNodeName: "", StartSubErrorLog: flagNodeSlice{Values: []node{}}, @@ -172,7 +172,7 @@ func (c *Configuration) CheckFlags() error { flag.StringVar(&c.SubscribersDataFolder, "subscribersDataFolder", fc.SubscribersDataFolder, "The data folder where subscribers are allowed to write their data if needed") flag.StringVar(&c.CentralNodeName, "centralNodeName", fc.CentralNodeName, "The name of the central node to receive messages published by this node") - flag.IntVar(&c.PublisherServiceSayhello, "publisherServiceSayhello", fc.PublisherServiceSayhello, "Make the current node send hello messages to central at given interval in seconds") + flag.IntVar(&c.StartPubSayHello, "startPubSayHello", fc.StartPubSayHello, "Make the current node send hello messages to central at given interval in seconds") flag.Var(&c.StartSubErrorLog, "startSubErrorLog", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubSayHello, "startSubSayHello", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") diff --git a/etc/config.toml b/etc/config.toml index d9acd61..4d0ff37 100644 --- a/etc/config.toml +++ b/etc/config.toml @@ -6,7 +6,7 @@ DefaultMessageTimeout = 5 NodeName = "central" ProfilingPort = "" PromHostAndPort = "" -PublisherServiceSayhello = 30 +StartPubSayhello = 0 SubscribersDataFolder = "./data" [StartSubCLICommand] diff --git a/startup_processes.go b/startup_processes.go index c4035c4..01cfce7 100644 --- a/startup_processes.go +++ b/startup_processes.go @@ -131,13 +131,13 @@ func (s *server) ProcessesStart() { // Define a process of kind publisher with subject for SayHello to central, // and register a procFunc with the process that will handle the actual // sending of say hello. - if s.configuration.PublisherServiceSayhello != 0 { + if s.configuration.StartPubSayHello != 0 { fmt.Printf("Starting SayHello Publisher: %#v\n", s.nodeName) sub := newSubject(SayHello, EventNACK, s.configuration.CentralNodeName) proc := newProcess(s.processes, s.newMessagesCh, s.configuration, sub, s.errorKernel.errorCh, processKindPublisher, []node{}, nil) - // Define the procFun to be used for the process. + // Define the procFunc to be used for the process. proc.procFunc = procFunc( func() error { for { @@ -158,7 +158,7 @@ func (s *server) ProcessesStart() { log.Printf("error: ProcessesStart: %v\n", err) } proc.newMessagesCh <- []subjectAndMessage{sam} - time.Sleep(time.Second * time.Duration(s.configuration.PublisherServiceSayhello)) + time.Sleep(time.Second * time.Duration(s.configuration.StartPubSayHello)) } }) go proc.spawnWorker(s)