Skip to content

Commit d46e5d5

Browse files
committed
fix: improve task queue resizing condition and API usage
- Change condition to resize the task queue when it is greater than or equal to 2 instead of just greater than 2 Signed-off-by: appleboy <[email protected]>
1 parent e194b80 commit d46e5d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ring.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (s *Ring) Request() (core.TaskMessage, error) {
109109
s.head = (s.head + 1) % len(s.taskQueue)
110110
s.count--
111111

112-
if n := len(s.taskQueue) / 2; n > 2 && s.count <= n {
112+
if n := len(s.taskQueue) / 2; n >= 2 && s.count <= n {
113113
s.resize(n)
114114
}
115115

0 commit comments

Comments
 (0)