Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deelawn committed May 17, 2024
1 parent f481d9d commit 0a18705
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gno.me/event/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"time"
)

type Server struct {
Expand All @@ -25,7 +26,7 @@ func NewServer(creator Creator, applier Applier, done chan struct{}) *Server {
}

// TODO: need some type of monitoring for if this fails
func (s Server) Start(port string) {
func (s *Server) Start(port string) {
mux := http.NewServeMux()
mux.HandleFunc("/events", handleEvents)
srv := &http.Server{
Expand All @@ -44,5 +45,7 @@ func (s Server) Start(port string) {

func (s Server) Stop() {
// TODO: should finish all current requests before shutting down.
s.server.Shutdown(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
s.server.Shutdown(ctx)
}

0 comments on commit 0a18705

Please sign in to comment.