Skip to content

Conversation

@d10i
Copy link

@d10i d10i commented Aug 2, 2024

Problem

When acquiring the sqlserver lock, it fails immediately if the lock can't be acquired. When running multiple migrations concurrently, only one of them will succeed and the other ones will fail.

Solution

Wait for up to 10 seconds when acquiring the lock. This way it lets the other entity that has acquired the lock do its job first. This is consistent with what this library does for postgres (though it waits indefinitely) and for mysql.

Fixes #253

When acquiring the `sqlserver` lock, it fails immediately if the lock
can't be acquired. When running multiple migrations concurrently, only
one of them will succeed and the other ones will fail.

Wait for up to 10 seconds when acquiring the lock. This way it lets the
other entity that has acquired the lock do its job first. This is
consistent with what this library does for `postgres` (though it waits
indefinitely) and for `mysql`.
@d10i d10i force-pushed the bug/mssql-lock-bug branch from b21a2c9 to 78a9f80 Compare October 25, 2024 08:50
@dhui
Copy link
Member

dhui commented Apr 17, 2025

@d10i Thanks for the PR. I'm closing this in favor of #1186 since the approach to block indefinitely is better than an arbitrarily chosen timeout interval, which may not work for all users.

@dhui dhui closed this Apr 17, 2025
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.

SQL Server Driver Attempts to Release Nonexistent Locks

2 participants