Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make Sidekiq retry configurable #1115

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ Alternatively you can set values through `.env` file. Values in `.env` file will

## Sidekiq

| Environment Variable | Type | Description | Default |
| -------------------- | ------ | --------------------- | ------- |
| SIDEKIQ_REDIS_URL | String | Redis URL for Sidekiq | |
| Environment Variable | Type | Description | Default |
| -------------------- | ------- | ---------------------------- | ------- |
| SIDEKIQ_REDIS_URL | String | Redis URL for Sidekiq | |
| SIDEKIQ_RETRY | Integer | Retry times for a failed job | `0` |

!!! tip

Expand Down
4 changes: 4 additions & 0 deletions lib/mihari/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Config < Anyway::Config
zoomeye_api_key: nil,
# sidekiq
sidekiq_redis_url: nil,
sidekiq_retry: 0,
# others
hide_config_values: true,
ignore_error: false,
Expand Down Expand Up @@ -174,6 +175,9 @@ class Config < Anyway::Config
# @!attribute [r] sidekiq_redis_url
# @return [URI, nil]

# @!attribute [r] sidekiq_retry
# @return [Integer]

def database_url=(val)
super(URI(val.to_s))
end
Expand Down
1 change: 1 addition & 0 deletions lib/mihari/sidekiq/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Sidekiq.configure_server do |config|
config.redis = {url: Mihari.config.sidekiq_redis_url.to_s}
config.default_job_options = {retry: Mihari.config.sidekiq_retry}
end

Sidekiq.configure_client do |config|
Expand Down