Skip to content

Add per-table concurrent timeout overrides - #160

Open
mathyoudawson wants to merge 3 commits into
masterfrom
add-table-specific-timeout-overrides
Open

Add per-table concurrent timeout overrides#160
mathyoudawson wants to merge 3 commits into
masterfrom
add-table-specific-timeout-overrides

Conversation

@mathyoudawson

Copy link
Copy Markdown

Summary

  • Adds an optional table_overrides config hash to register_database, letting apps override concurrent_lock_timeout/concurrent_statement_timeout for specific tables (e.g. a huge payments table needing a longer statement timeout than the database-wide default).
  • Falls back to the database-level value for any table (or key) not listed. Per-migration set_lock_timeout/set_statement_timeout still takes precedence over both.
  • Fully backward compatible: table_overrides defaults to {}, no behaviour changes for existing configs.
Nandi.configure do |config|
  config.register_database(:primary,
    concurrent_statement_timeout: 600_000,   # 10 min database-wide default
    table_overrides: {
      payments: { concurrent_statement_timeout: 1_800_000 }, # 30 min for payments
    })
end

Bumps version to 3.2.0.

Test plan

  • bundle exec rspec — 447 examples, 0 failures
  • bundle exec rubocop — 0 offenses
  • New specs added for MultiDatabase::Database, Config, and Migration covering: override present/absent, partial-key overrides, string/symbol table names, per-migration override precedence, and multi-database database_name + table resolution together

🤖 Generated with Claude Code

…errides

Lets apps configure a table_overrides hash on register_database so a
specific table (e.g. a huge payments table) can have a longer
concurrent statement/lock timeout than the database-wide default,
without loosening it for every table. Falls back to the database-level
value for any table (or key) not listed; per-migration
set_lock_timeout/set_statement_timeout still takes precedence.

Bumps version to 3.2.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mathyoudawson
mathyoudawson marked this pull request as ready for review August 14, 2026 14:30
table and mixins were each concatenating up_instructions + down_instructions
inline; pull that into a shared private helper instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant