mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
replace decreasing timeout with fixed timeout
This commit is contained in:
parent
0371abad1d
commit
c0d5c4e868
1 changed files with 1 additions and 2 deletions
|
@ -77,13 +77,12 @@ public final class LsQueueUtils {
|
|||
private static int drain(final BlockingQueue<JrubyEventExtLibrary.RubyEvent> queue,
|
||||
final Collection<JrubyEventExtLibrary.RubyEvent> collection, final int count,
|
||||
final long nanos) throws InterruptedException {
|
||||
final long deadline = System.nanoTime() + nanos;
|
||||
int added = 0;
|
||||
do {
|
||||
added += queue.drainTo(collection, count - added);
|
||||
if (added < count) {
|
||||
final JrubyEventExtLibrary.RubyEvent event =
|
||||
queue.poll(deadline - System.nanoTime(), TimeUnit.NANOSECONDS);
|
||||
queue.poll(nanos, TimeUnit.NANOSECONDS);
|
||||
if (event == null) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue