Skip to content

Commit

Permalink
change proxy close
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Nov 10, 2023
1 parent 44d0df6 commit 0afc5b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/proxy/creator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package proxy

import (
"context"
"errors"
"math/big"
"net/http"
Expand Down Expand Up @@ -211,12 +212,16 @@ func CreateProxy(args ArgsProxy) (ProxyHandler, error) {
}
}()

proxyInstance.closableComponents.Add(proxyInstance.httpServer)

return proxyInstance, nil
}

// Close will close the proxy
func (p *proxy) Close() {
p.closableComponents.Close()

shutdownContext, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

_ = p.httpServer.Shutdown(shutdownContext)
_ = p.httpServer.Close()
}

0 comments on commit 0afc5b8

Please sign in to comment.