GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - keygen-sh/statement_timeout: Wrap an Active Record transaction or query in a local statement timeout.

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Gemfile
Gemfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
SECURITY.md
SECURITY.md
 
 
statement_timeout.gemspec
statement_timeout.gemspec
 
 

Repository files navigation

statement_timeout

CI Gem Version

Use statement_timeout to wrap an Active Record transaction or query in a local statement timeout.

This gem was extracted from Keygen.

Sponsored by:

Keygen

A fair source software licensing and distribution API.

Installation

Add this line to your application's Gemfile:

gem 'statement_timeout'

And then execute:

$ bundle

Or install it yourself as:

$ gem install statement_timeout

Configuration

StatementTimeout.configure do |config|
  # When using a connection pooler like PgBouncer while in transaction mode, it
  # is required that you change the default mode from :session to :transaction
  # otherwise the statement timeouts may be SET on the wrong connection.
  config.default_mode = :transaction
end

Usage

User.statement_timeout 42.minutes do
  some_expensive_operation
end

User.posts.statement_timeout 10.seconds do
  some_cheap_operation
end

Post.statement_timeout 10.minutes do |conn|
  conn.transaction { archive_old_posts }
end

Tag.statement_timeout 6.hours, mode: :session do |conn|
  conn.execute 'VACUUM ANALYZE tags'
end

Supported databases

We currently support PostgreSQL. We'd love contributions that add MySQL, MariaDB, and SQLite support, but we probably won't add it ourselves.

Supported Rubies

statement_timeout supports Ruby 3.1 and above. We encourage you to upgrade if you're on an older version. Ruby 3 provides a lot of great features, like better pattern matching and a new shorthand hash syntax.

Is it any good?

Yes.

Contributing

If you have an idea, or have discovered a bug, please open an issue or create a pull request.

License

The gem is available as open source under the terms of the MIT License.

About

Wrap an Active Record transaction or query in a local statement timeout.

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

22 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Sponsor this project

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.