diff --git a/cmd/fdsn-holdings-consumer/main.go b/cmd/fdsn-holdings-consumer/main.go index 2fb4a0f..bd5e9a0 100644 --- a/cmd/fdsn-holdings-consumer/main.go +++ b/cmd/fdsn-holdings-consumer/main.go @@ -42,7 +42,7 @@ var ( db *sql.DB queueURL string sqsClient sqs.SQS - s3Client *s3.S3 + s3Client s3.S3 saveHoldings *sql.Stmt ) @@ -66,12 +66,10 @@ func initAwsClient() { log.Fatalf("error checking queueURL %s: %s", queueURL, err.Error()) } - s3c, err := s3.NewWithMaxRetries(3) + s3Client, err = s3.NewWithMaxRetries(3) if err != nil { log.Fatalf("error creating S3 client: %s", err) } - s3Client = &s3c - } func main() { @@ -132,7 +130,6 @@ ping: err = db.Ping() if err != nil { log.Println("problem pinging DB sleeping and retrying") - health.Ok() //send heartbeat time.Sleep(time.Second * 30) continue ping } diff --git a/cmd/fdsn-quake-consumer/main.go b/cmd/fdsn-quake-consumer/main.go index 5961c06..9a42a12 100644 --- a/cmd/fdsn-quake-consumer/main.go +++ b/cmd/fdsn-quake-consumer/main.go @@ -96,8 +96,6 @@ ping: err = db.Ping() if err != nil { log.Println("problem pinging DB sleeping and retrying") - health.Ok() //send heartbeat - time.Sleep(time.Second * 30) continue ping } diff --git a/cmd/fdsn-ws/server.go b/cmd/fdsn-ws/server.go index a05ac9c..c10ec50 100644 --- a/cmd/fdsn-ws/server.go +++ b/cmd/fdsn-ws/server.go @@ -3,6 +3,7 @@ package main import ( "context" "database/sql" + "fmt" "log" "net/http" "os" @@ -16,6 +17,8 @@ import ( _ "github.com/lib/pq" ) +const servicePort = ":8080" //http service port + var ( db *sql.DB decoder = newDecoder() // decoder for URL queries. @@ -85,7 +88,7 @@ func main() { log.Println("starting server") server := &http.Server{ - Addr: ":8080", + Addr: servicePort, Handler: mux, ReadTimeout: 1 * time.Minute, WriteTimeout: 10 * time.Minute, @@ -100,7 +103,7 @@ func healthCheck() { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - msg, err := health.Check(ctx, ":8080/soh", timeout) + msg, err := health.Check(ctx, fmt.Sprintf("%s/soh", servicePort), timeout) if err != nil { log.Printf("status: %v", err) os.Exit(1)