Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleep duration as a config parameter #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/logstash/inputs/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# newer. Anything older does not support the operations used by batching.
#
module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
BATCH_EMPTY_SLEEP = 0.25

config_name "redis"

default :codec, "json"
Expand Down Expand Up @@ -49,6 +47,9 @@ module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
# The number of events to return from Redis using EVAL.
config :batch_count, :validate => :number, :default => 125

# The number of seconds to sleep if Redis list is empty
config :sleep_sec, :validate => :number, :default => 0.25

public
# public API
# use to store a proc that can provide a redis instance or mock
Expand Down Expand Up @@ -192,7 +193,7 @@ def list_batch_listener(redis, output_queue)
end

if results.size.zero?
sleep BATCH_EMPTY_SLEEP
sleep @sleep_sec
end

# Below is a commented-out implementation of 'batch fetch'
Expand Down