Skip to content

Commit

Permalink
update readme and initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
nduitz committed Jun 26, 2024
1 parent 97de8fa commit 8c033b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ class MyJob < ActiveJob::Base
end
```

### Control redis connection errors

```ruby
class MyJob < ActiveJob::Base
# Proc gets the job instance including its arguments, and as keyword arguments the resource(lock key) `resource` and the original error `error`
unique :until_executing, on_redis_connection_error: ->(job, resource: _, error: _) { job.logger.info "Oops: #{job.arguments}" }

def perform(args)
# work
end
end
```

### Control lock key arguments

```ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
#
# config.on_conflict = :raise

# Default action on redis connection error. Can be set per job.
# Allowed values are
# :raise - raises ActiveJob::Uniqueness::JobNotUnique
# proc - custom Proc. For example, ->(job, resource: _, error: _) { job.logger.info("Job already in queue: #{job.class.name} #{job.arguments.inspect} (#{job.job_id})") }
#
# config.on_conflict = :raise

# Digest method for lock keys generating. Expected to have `hexdigest` class method.
#
# config.digest_method = OpenSSL::Digest::MD5
Expand Down

0 comments on commit 8c033b6

Please sign in to comment.