Skip to content

Update database.yml pool size in sidekiq recipe  #391

@plantoeat

Description

@plantoeat

I have a custom recipe that is updating my database.yml file after the sidekiq recipe runs so my database.yml file has pool: #{node['sidekiq']['concurrency']+2}. Before this change I would get frequent ActiveRecord::ConnectionTimeoutError errors.

Im my case, my custom recipe is using sed to find a replace pool: 5 with pool: 7.
command "sed -ibak --follow-symlinks 's/pool: #{node['sidekiq']['concurrency']}/pool: #{(node['sidekiq']['concurrency']+2)}/g' #{db_yaml_file}"

Can this change be made in the main sidekiq recipe so I don't have to have a custom recipe?

Two lines need to be updated:

command "sed -ibak --follow-symlinks 's/reconnect/pool: #{node['sidekiq']['concurrency']}\\\n reconnect/g' #{db_yaml_file}"

only_if "test -f #{db_yaml_file} && ! grep 'pool: *#{node['sidekiq']['concurrency']}' #{db_yaml_file}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions