mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 06:30:07 +08: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)
|
request := value.Interface().(OperationRequest)
|
||||||
|
|
||||||
c.processorLimitCond.L.Lock()
|
if c.processorLimit > 0 {
|
||||||
for atomic.LoadInt32(&c.currentProcessor) > c.processorLimit {
|
c.processorLimitCond.L.Lock()
|
||||||
c.processorLimitCond.Wait()
|
for atomic.LoadInt32(&c.currentProcessor) > c.processorLimit {
|
||||||
|
c.processorLimitCond.Wait()
|
||||||
|
}
|
||||||
|
atomic.AddInt32(&c.currentProcessor, 1)
|
||||||
|
c.processorLimitCond.L.Unlock()
|
||||||
}
|
}
|
||||||
atomic.AddInt32(&c.currentProcessor, 1)
|
|
||||||
c.processorLimitCond.L.Unlock()
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer atomic.AddInt32(&c.currentProcessor, -1)
|
if c.processorLimit > 0 {
|
||||||
defer c.processorLimitCond.Signal()
|
defer atomic.AddInt32(&c.currentProcessor, -1)
|
||||||
|
defer c.processorLimitCond.Signal()
|
||||||
|
}
|
||||||
request()
|
request()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user