Skip to content

Commit

Permalink
Consumer config management (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
udgover authored Nov 6, 2024
1 parent 00c0cf5 commit 6ac1b6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/events/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def run(self):
prog="yeti-consumer", description="Consume events and logs from the event bus"
)
parser.add_argument(
"--concurrency", type=int, default=None, help="Number of consumers to start"
"--concurrency",
type=int,
help="Number of consumers to start",
default=yeti_config.get("events", "consumers_concurrency", None),
)
parser.add_argument(
"type", choices=["events", "logs"], help="Type of consumer to start"
Expand Down
2 changes: 2 additions & 0 deletions extras/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if [[ "$1" = 'webserver' ]]; then
poetry run uvicorn core.web.webapp:app --reload --host 0.0.0.0
elif [[ "$1" = 'tasks' ]]; then
poetry run celery -A core.taskscheduler worker --loglevel=INFO --purge -B -P threads
elif [[ "$1" = 'events-tasks' ]]; then
poetry run python -m core.events.consumers events
elif [[ "$1" = 'create-user' ]]; then
poetry run python yetictl/cli.py create-user "${@:2}"
elif [[ "$1" = 'reset-password' ]]; then
Expand Down
3 changes: 3 additions & 0 deletions yeti.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ enabled = True
# tls = ok

[events]
# if max_queue_size is not defined, defaults to 30000
max_queue_size = 30000
# if concurrency is not defined, defaults to multiprocessing.cpu_count
consumers_concurrency = 2

[misp]

Expand Down

0 comments on commit 6ac1b6b

Please sign in to comment.