diff --git a/src/caduceus/caduceus.go b/src/caduceus/caduceus.go index 47ec929c..585b7044 100644 --- a/src/caduceus/caduceus.go +++ b/src/caduceus/caduceus.go @@ -80,6 +80,8 @@ func getValidator(v *viper.Viper) (validator secure.Validator, err error) { // caduceus is the driver function for Caduceus. It performs everything main() would do, // except for obtaining the command-line arguments (which are passed to it). func caduceus(arguments []string) int { + totalTime := time.Now() + var ( f = pflag.NewFlagSet(applicationName, pflag.ContinueOnError) v = viper.New() @@ -212,26 +214,33 @@ func caduceus(arguments []string) int { } // make sure dns is ready before preceeding + logger.Debug("Reaching out to see if DNS is ready.") + now := time.Now() dnsReadyChan := make(chan bool, 1) go caduceusHealth.dnsReady(selfURL.String(), dnsReadyChan) <-dnsReadyChan - logger.Debug("DNS ready") + logger.Debug("DNS is ready. elapsed time: %v", time.Since(now)) + // todo: add message webhookFactory.PrepareAndStart() - logger.Info("Caduceus is up and running!") - // Attempt to obtain the current listener list from current system without having to wait for listener reregistration. + logger.Debug("Attempting to obtain current listener list from %v", v.GetString("start.apiPath")) + now = time.Now() startChan := make(chan webhook.Result, 1) webhookFactory.Start.GetCurrentSystemsHooks(startChan) var webhookStartResults webhook.Result = <-startChan if webhookStartResults.Error != nil { logger.Error(webhookStartResults.Error) } else { + // todo: add message webhookFactory.SetList(webhook.NewList(webhookStartResults.Hooks)) caduceusSenderWrapper.Update(webhookStartResults.Hooks) } + logger.Debug("current listener retrieval, elapsed time: %v", time.Since(now)) + logger.Info("Caduceus is up and running! elapsed time: %v", time.Since(totalTime)) + var ( signals = make(chan os.Signal, 1) ) diff --git a/src/caduceus/caduceus_type.go b/src/caduceus/caduceus_type.go index 536183cf..9177f3e3 100644 --- a/src/caduceus/caduceus_type.go +++ b/src/caduceus/caduceus_type.go @@ -138,6 +138,7 @@ func (ch *CaduceusHealth) dnsReady(address string, ready chan bool) { ready <- true break } + time.Sleep(time.Second * 1) // wait a moment between queries } } diff --git a/src/glide.lock b/src/glide.lock index 2f0da7e7..02f3cffb 100644 --- a/src/glide.lock +++ b/src/glide.lock @@ -1,5 +1,5 @@ -hash: f198dc9abed833875765f1ed2a91d3d1cf3deeb152b4e365869d09984cdf6498 -updated: 2017-08-02T14:46:20.617647534-07:00 +hash: f6be7ee20e67038ed7c187666ad75fdb77bd8c218b4fda3537fd99fbdba42eeb +updated: 2017-08-10T10:02:08.548578557-07:00 imports: - name: github.com/aws/aws-sdk-go version: 7be45195c3af1b54a609812f90c05a7e492e2491 @@ -34,7 +34,7 @@ imports: subpackages: - linux - name: github.com/Comcast/webpa-common - version: 2a34f4bb4e58ab1b0df77cf052a1a098aec1a282 + version: 2943129fb5ff4723c43aeee7e6b36b5e00e46c47 subpackages: - concurrent - handler @@ -139,11 +139,11 @@ imports: subpackages: - codec - name: golang.org/x/sys - version: e312636bdaa2fac4f0acde9d17ab9fbad2b4ad10 + version: e42485b6e20ae7d2304ec72e535b103ed350cc02 subpackages: - unix - name: golang.org/x/text - version: 3bd178b88a8180be2df394a1fbb81313916f0e7b + version: b19bf474d317b857955b12035d2c5acb57ce8b01 subpackages: - transform - unicode/norm diff --git a/src/glide.yaml b/src/glide.yaml index 12ca3192..e75c6702 100644 --- a/src/glide.yaml +++ b/src/glide.yaml @@ -1,7 +1,7 @@ package: . import: - package: github.com/Comcast/webpa-common - version: 2a34f4bb4e58ab1b0df77cf052a1a098aec1a282 + version: 2943129fb5ff4723c43aeee7e6b36b5e00e46c47 subpackages: - concurrent - handler