
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Gem to obtain and release manual db locks. This can be utilized for example to make sure that certain rake tasks do not run in parallel on the same database (for example when cron jobs run for too long or are accidentally started multiple times). Currently only supports:
Add this line to your application's Gemfile:
gem 'db_lock'
then run bundle
DBLock.with_lock('name_of_lock', 5) do
# code here
end
Before the code block is executed, it will attempt to acquire a db lock for X seconds (5 in this example). If this fails it will raise an DBLock::AlreadyLocked
error. The lock is released after the block is executed, even if the block raised an error itself.
The locking will already fail with an error if the current thread already holds a lock via this gem.
Locks are achieved on the database via:
Database | Locking method |
---|---|
MySQL | GET_LOCK |
Postgres | pg_advisory_lock |
SQLServer | sp_getapplock |
If you prefix the lock with a .
in a Rails application, .
will be automatically replaced with YourAppName.environment
(production/development/etc).
If the lock name exceeds 64 characters, it will be replaced with a lock name of 64 characters, that consists of a pre- and suffix from the original lock name and a middle MD5 checksum.
Bundle with the adapter you want to use, for example
$ bundle --with mysql
Run rspec with the database url env variables set. It will only run the specs it can run and skip the others.
For example
$ MYSQL_URL=mysql2://root:dummy@localhost/test SQLSERVER_URL=sqlserver://root:dummy@localhost/test rspec
FAQs
Unknown package
We found that db_lock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.