Skip to content

Commit 276560a

Browse files
committed
improve fastcgi reconnection
1 parent 7704f81 commit 276560a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pool.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,25 @@ func (this *Pool) Client() (*Client, error) {
7272
return nil, errors.New("no available clients to use")
7373
}
7474

75-
// 查找空闲的
75+
// find a free one
7676
for _, client := range this.clients {
7777
if client.isAvailable && client.isFree {
7878
return client, nil
7979
}
8080
}
8181

82-
// 查找可用的
82+
// find available on
8383
for _, client := range this.clients {
8484
if client.isAvailable {
8585
return client, nil
8686
}
8787
}
8888

89+
// use first one
90+
err := this.clients[0].Connect()
91+
if err == nil {
92+
return this.clients[0], nil
93+
}
94+
8995
return nil, errors.New("no available clients to use")
9096
}

0 commit comments

Comments
 (0)