Skip to content

Commit

Permalink
Fixes #36771 - introduce sqlite timeout tuning (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou authored Sep 26, 2023
1 parent dfc918d commit adc6195
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/smart_proxy_container_gateway/container_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class Plugin < ::Proxy::Plugin

default_settings :pulp_endpoint => "https://#{`hostname`.strip}",
:katello_registry_path => '/v2/',
:sqlite_db_path => '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
:sqlite_db_path => '/var/lib/foreman-proxy/smart_proxy_container_gateway.db',
:sqlite_timeout => 30_000

# Load defaults that copy values from SETTINGS. This is done as
# programmable settings since SETTINGS isn't initialized during plugin
Expand Down
3 changes: 2 additions & 1 deletion lib/smart_proxy_container_gateway/container_gateway_main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def insert_token(username, token, expire_at_string, clear_expired_tokens: true)

def initialize_db
file_path = Proxy::ContainerGateway::Plugin.settings.sqlite_db_path
conn = Sequel.connect("sqlite://#{file_path}")
sqlite_timeout = Proxy::ContainerGateway::Plugin.settings.sqlite_timeout
conn = Sequel.connect("sqlite://#{file_path}", timeout: sqlite_timeout)
container_gateway_path = $LOAD_PATH.detect { |path| path.include? 'smart_proxy_container_gateway' }
begin
Sequel::Migrator.check_current(conn, "#{container_gateway_path}/smart_proxy_container_gateway/sequel_migrations")
Expand Down
2 changes: 2 additions & 0 deletions settings.d/container_gateway.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
:pulp_client_ssl_key: 'RSA private key for the Pulp certificate'
:katello_registry_path: 'Katello container registry suffix, e.g., /v2/'
:sqlite_db_path: '/var/lib/foreman-proxy/smart_proxy_container_gateway.db'
# Database busy timeout in milliseconds
:sqlite_timeout: 30000

0 comments on commit adc6195

Please sign in to comment.