This commit is contained in:
parent
3f27f5c943
commit
4d99fce3bb
1 changed files with 7 additions and 1 deletions
|
@ -89,7 +89,13 @@ func connectToServer(ctx context.Context, uuid uuid.UUID) {
|
|||
c, res, err := websocket.Dial(ctx, conf.Worker.Address+"/worker", &websocket.DialOptions{
|
||||
HTTPHeader: headers,
|
||||
})
|
||||
defer c.CloseNow()
|
||||
|
||||
// Cleanup connection if exists to prevent FD leak
|
||||
defer func(){
|
||||
if c != nil {
|
||||
c.CloseNow()
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if res != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue