Skip to content

Commit

Permalink
changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
bpeng committed Dec 12, 2024
1 parent 363a81b commit c62f9ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 2 additions & 5 deletions cmd/fdsn-holdings-consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
db *sql.DB
queueURL string
sqsClient sqs.SQS
s3Client *s3.S3
s3Client s3.S3
saveHoldings *sql.Stmt
)

Expand All @@ -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() {
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/fdsn-quake-consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/fdsn-ws/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"database/sql"
"fmt"
"log"
"net/http"
"os"
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit c62f9ea

Please sign in to comment.