Skip to content

Commit

Permalink
work in pgoress for address issues with NetBox database and Logstash'…
Browse files Browse the repository at this point in the history
…s NetBox cache, should fix locking issues (idaholab#259)
  • Loading branch information
mmguero committed Oct 27, 2023
1 parent 8831476 commit 20a89d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions logstash/ruby/netbox_enrich.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def filter(event)

# make sure the connection to the NetBox API exists and wasn't flagged for reconnect
if @netbox_conn.nil? || @netbox_conn_needs_reset
@netbox_conn_lock.release_read_lock
@netbox_conn_lock.acquire_write_lock
begin
if @netbox_conn.nil? || @netbox_conn_needs_reset
Expand All @@ -254,6 +255,7 @@ def filter(event)
end # connection check in write lock
ensure
@netbox_conn_lock.release_write_lock
@netbox_conn_lock.acquire_read_lock
end
end # connection check in read lock

Expand Down Expand Up @@ -723,13 +725,15 @@ def filter(event)
end # check if device was created and has ID

if _exception_error_connection && !@netbox_conn_resetting
@netbox_conn_lock.release_read_lock
@netbox_conn_lock.acquire_write_lock
begin
if !@netbox_conn_resetting
@netbox_conn_needs_reset = true
end
ensure
@netbox_conn_lock.release_write_lock
@netbox_conn_lock.acquire_read_lock
end
end
ensure
Expand Down

0 comments on commit 20a89d5

Please sign in to comment.