Skip to content

Commit

Permalink
Merge pull request #42 from Comcast/feature/removeDnsReadyCode
Browse files Browse the repository at this point in the history
Feature/removeDnsReadyCode
  • Loading branch information
schmidtw authored Aug 10, 2017
2 parents f19501d + 103eef7 commit b17e22a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
10 changes: 2 additions & 8 deletions src/caduceus/caduceus.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,10 @@ func caduceus(arguments []string) int {
return 1
}

// make sure dns is ready before preceeding
logger.Debug("Reaching out to see if DNS is ready.")
logger.Debug("calling webhookFactory.PrepareAndStart")
now := time.Now()
dnsReadyChan := make(chan bool, 1)
go caduceusHealth.dnsReady(selfURL.String(), dnsReadyChan)
<-dnsReadyChan
logger.Debug("DNS is ready. elapsed time: %v", time.Since(now))

// todo: add message
webhookFactory.PrepareAndStart()
logger.Debug("webhookFactory.PrepareAndStart done. elapsed time: %v", time.Since(now))

// 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"))
Expand Down
19 changes: 0 additions & 19 deletions src/caduceus/caduceus_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/Comcast/webpa-common/logging"
"github.com/Comcast/webpa-common/secure"
"github.com/Comcast/webpa-common/secure/key"
"net/http"
"time"
)

Expand Down Expand Up @@ -124,24 +123,6 @@ func (ch *CaduceusHealth) IncrementBucket(inSize int) {
}
}

func (ch *CaduceusHealth) dnsReady(address string, ready chan bool) {
req, err := http.NewRequest("GET", address, nil)
if err != nil {
return
}
client := http.Client{}

var resp *http.Response
for resp == nil {
resp, err = client.Do(req)
if err == nil {
ready <- true
break
}
time.Sleep(time.Second * 1) // wait a moment between queries
}
}

// Below is the struct and implementation of our worker pool factory
type WorkerPoolFactory struct {
NumWorkers int
Expand Down
6 changes: 3 additions & 3 deletions src/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/glide.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package: .
import:
- package: github.com/Comcast/webpa-common
version: 2943129fb5ff4723c43aeee7e6b36b5e00e46c47
version: 0ed5d670f2e9fd8047e21f3765d4b0f5c7895a31
subpackages:
- concurrent
- handler
Expand Down

0 comments on commit b17e22a

Please sign in to comment.