mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
skip limiting if limit is zero
This commit is contained in:
parent
8251d1140e
commit
fbb82a5c9c
|
@ -85,16 +85,20 @@ func NewLimitedOutOfOrderProcessor(limit int32) (c *LimitedOutOfOrderProcessor)
|
|||
|
||||
request := value.Interface().(OperationRequest)
|
||||
|
||||
if c.processorLimit > 0 {
|
||||
c.processorLimitCond.L.Lock()
|
||||
for atomic.LoadInt32(&c.currentProcessor) > c.processorLimit {
|
||||
c.processorLimitCond.Wait()
|
||||
}
|
||||
atomic.AddInt32(&c.currentProcessor, 1)
|
||||
c.processorLimitCond.L.Unlock()
|
||||
}
|
||||
|
||||
go func() {
|
||||
if c.processorLimit > 0 {
|
||||
defer atomic.AddInt32(&c.currentProcessor, -1)
|
||||
defer c.processorLimitCond.Signal()
|
||||
}
|
||||
request()
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in a new issue