File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ func (p *AsyncPool) Get() AsynConn {
66
66
}
67
67
68
68
p .getCount ++
69
- if p .MaxGetCount != 0 && p .getCount >= p .MaxGetCount {
69
+ if p .MaxGetCount != 0 && p .getCount > p .MaxGetCount {
70
70
p .getCount --
71
71
p .mu .Unlock ()
72
72
return errorConnection {ErrPoolExhausted }
@@ -187,17 +187,17 @@ func (pc *asyncPoolConnection) Err() error {
187
187
188
188
func (pc * asyncPoolConnection ) Do (commandName string , args ... interface {}) (reply interface {}, err error ) {
189
189
if pc .p .MaxDoCount != 0 {
190
- if atomic .AddInt32 (& pc .p .doCount , 1 ) >= int32 (pc .p .MaxDoCount ) {
190
+ if atomic .AddInt32 (& pc .p .doCount , 1 ) > int32 (pc .p .MaxDoCount ) {
191
191
atomic .AddInt32 (& pc .p .doCount , - 1 )
192
192
return nil , ErrPoolExhausted
193
193
}
194
- }
195
194
196
- reply , err = pc . c . Do ( commandName , args ... )
197
- if pc .p .MaxDoCount != 0 {
198
- atomic . AddInt32 ( & pc . p . doCount , - 1 )
195
+ defer func () {
196
+ atomic . AddInt32 ( & pc .p .doCount , - 1 )
197
+ }( )
199
198
}
200
- return reply , err
199
+
200
+ return pc .c .Do (commandName , args ... )
201
201
}
202
202
203
203
func (pc * asyncPoolConnection ) AsyncDo (commandName string , args ... interface {}) (ret AsyncRet , err error ) {
You can’t perform that action at this time.
0 commit comments