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

Chnage concurrency to :shared and publish outside of synchronized code #60

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions lib/logstash/outputs/bigquery/batcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def enqueue_push(message, queue)
def enqueue(message)
@lock.write_lock.lock

orig = nil
begin
is_flush_request = message.nil?

Expand All @@ -49,15 +50,14 @@ def enqueue(message)
if is_flush_request || length_met || size_met
orig = @batch
clear

yield(orig) if block_given?
return orig
end

nil
ensure
@lock.write_lock.unlock
end

yield(orig) if block_given? && !orig.nil?
jsvd marked this conversation as resolved.
Show resolved Hide resolved
return orig
end

# removes all elements from the batch
Expand Down
2 changes: 1 addition & 1 deletion lib/logstash/outputs/google_bigquery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
class LogStash::Outputs::GoogleBigQuery < LogStash::Outputs::Base
config_name 'google_bigquery'

concurrency :single
concurrency :shared

# Google Cloud Project ID (number, not Project Name!).
config :project_id, validate: :string, required: true
Expand Down