File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -90,20 +90,18 @@ func (b *basicBatcher) Get() ([]interface{}, error) {
9090 b .lock .RUnlock ()
9191 return nil , ErrDisposed
9292 }
93+ b .lock .RUnlock ()
9394
9495 var timeout <- chan time.Time
9596 if b .maxTime > 0 {
9697 timeout = time .After (b .maxTime )
9798 }
98- b .lock .RUnlock ()
9999
100100 select {
101- case items := <- b .batchChan :
102- b .lock .RLock ()
103- if b .disposed {
101+ case items , ok := <- b .batchChan :
102+ if ! ok {
104103 return nil , ErrDisposed
105104 }
106- b .lock .RUnlock ()
107105 return items , nil
108106 case <- timeout :
109107 b .lock .Lock ()
@@ -125,7 +123,7 @@ func (b *basicBatcher) Dispose() {
125123 b .lock .Lock ()
126124 b .disposed = true
127125 b .items = nil
128- b .batchChan = nil
126+ close ( b .batchChan )
129127 b .lock .Unlock ()
130128}
131129
You can’t perform that action at this time.
0 commit comments