Skip to content

Commit 480509e

Browse files
committed
Remove straggler references to advisory locks for uniqueness
Remove a few straggler references saying that advisory locks provide uniqueness. As of #28, this is no longer true and a unique index is used instead.
1 parent 560c6b4 commit 480509e

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

docs/README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,6 @@ insert_res.job
8484
insert_res.unique_skipped_as_duplicated
8585
```
8686

87-
### Custom advisory lock prefix
88-
89-
Unique job insertion takes a Postgres advisory lock to make sure that its uniqueness check still works even if two conflicting insert operations are occurring in parallel. Postgres advisory locks share a global 64-bit namespace, which is a large enough space that it's unlikely for two advisory locks to ever conflict, but to _guarantee_ that River's advisory locks never interfere with an application's, River can be configured with a 32-bit advisory lock prefix which it will use for all its locks:
90-
91-
```ruby
92-
client = River::Client.new(mock_driver)
93-
```
94-
95-
Doing so has the downside of leaving only 32 bits for River's locks (64 bits total - 32-bit prefix), making them somewhat more likely to conflict with each other.
96-
9787
## Inserting jobs in bulk
9888

9989
Use `#insert_many` to bulk insert jobs as a single operation for improved efficiency:

lib/insert_opts.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ def initialize(
7272
# given job kind, a single instance is allowed for each combination of args
7373
# and queues. If either args or queue is changed on a new job, it's allowed to
7474
# be inserted as a new job.
75-
#
76-
# Uniquenes is checked at insert time by taking a Postgres advisory lock,
77-
# doing a look up for an equivalent row, and inserting only if none was found.
78-
# There's no database-level mechanism that guarantees jobs stay unique, so if
79-
# an equivalent row is inserted out of band (or batch inserted, where a unique
80-
# check doesn't occur), it's conceivable that duplicates could coexist.
8175
class UniqueOpts
8276
# Indicates that uniqueness should be enforced for any specific instance of
8377
# encoded args for a job.

0 commit comments

Comments
 (0)