Skip to content

Commit

Permalink
use only one go routine
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Dec 28, 2023
1 parent 2b629ea commit db99d46
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions tools/walletextension/container/walletextension_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (w *WalletExtensionContainer) Start() error {
httpErrChan := w.httpServer.Start()
wsErrChan := w.wsServer.Start()

// Start a goroutine for handling HTTP server errors
// Start a goroutine for handling HTTP and WS server errors
go func() {
for {
select {
Expand All @@ -169,16 +169,6 @@ func (w *WalletExtensionContainer) Start() error {
// for other errors, we just log them
w.logger.Error("HTTP server error: %v", err)
}
case <-w.stopControl.Done():
return // Exit the goroutine when stop signal is received
}
}
}()

// Start a goroutine for handling WebSocket server errors
go func() {
for {
select {
case err := <-wsErrChan:
if errors.Is(err, http.ErrServerClosed) {
err = w.Stop() // Stop the container when the WS server is closed
Expand All @@ -195,7 +185,6 @@ func (w *WalletExtensionContainer) Start() error {
}
}
}()

return nil
}

Expand Down

0 comments on commit db99d46

Please sign in to comment.