Skip to content

Commit

Permalink
Merge pull request #1068 from ninoseki/split-parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki authored Mar 2, 2024
2 parents ca1c27b + 0d46fe8 commit 43838b6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/analyzers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ queries:

### Parallel

`parallel` (`bool`) controls whether to allow parallel execution or not. Optional. Defaults to `false`. Configurable via `PARALLEL` environment variable.
`parallel` (`bool`) controls whether to allow parallel execution or not. Optional. Defaults to `false`. Configurable via `ANALYZER_PARALLELISM` environment variable.

### Pagination Interval

Expand Down
3 changes: 2 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ Alternatively you can set values through `.env` file. Values in `.env` file will

| Environment Variable | Type | Description | Default |
| ------------------------- | ------- | ----------------------------------------- | ------- |
| ANALYZER_PARALLELISM | Boolean | Whether to run analyzers in parallel | `false` |
| EMITTER_PARALLELISM | Boolean | Whether to run emitters in parallel | `true` |
| IGNORE_ERROR | Boolean | Whether to ignore error while querying | `false` |
| PAGINATION_INTERVAL | Integer | Pagination interval | `0` |
| PAGINATION_LIMIT | Integer | Pagination limit | `100` |
| PARALLEL | Boolean | Whether to run queries in parallel | `false` |
| RETRY_EXPONENTIAL_BACKOFF | Boolean | Whether to use retry exponential back off | `true` |
| RETRY_INTERVAL | Integer | Retry interval | `5` |
| RETRY_TIMES | Integer | Retry times | `3` |
Expand Down
2 changes: 1 addition & 1 deletion docs/emitters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ options:

### Parallel

`parallel` (`bool`) controls whether to allow parallel execution or not. Optional. Defaults to `false`. Configurable via `PARALLEL` environment variable.
`parallel` (`bool`) controls whether to allow parallel execution or not. Optional. Defaults to `true`. Configurable via `EMITTER_PARALLELISM` environment variable.
2 changes: 1 addition & 1 deletion lib/mihari/analyzers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def ignore_error?
# @return [Boolean]
#
def parallel?
options[:parallel] || Mihari.config.parallel
options[:parallel] || Mihari.config.analyzer_parallelism
end

# @return [Array<String>, Array<Mihari::Models::Artifact>]
Expand Down
8 changes: 6 additions & 2 deletions lib/mihari/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class Config < Anyway::Config
ignore_error: false,
pagination_interval: 0,
pagination_limit: 100,
parallel: false,
analyzer_parallelism: false,
emitter_parallelism: true,
retry_exponential_backoff: true,
retry_interval: 5,
retry_times: 3,
Expand Down Expand Up @@ -146,7 +147,10 @@ class Config < Anyway::Config
# @!attribute [r] pagination_limit
# @return [Integer]

# @!attribute [r] parallel
# @!attribute [r] analyzer_parallelism
# @return [Boolean]

# @!attribute [r] emitter_parallelism
# @return [Boolean]

# @!attribute [r] ignore_error
Expand Down
2 changes: 1 addition & 1 deletion lib/mihari/emitters/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(rule:, options: nil)
# @return [Boolean]
#
def parallel?
options[:parallel] || Mihari.config.parallel
options[:parallel] || Mihari.config.emitter_parallelism
end

# A target to emit the data
Expand Down

0 comments on commit 43838b6

Please sign in to comment.