Skip to content

fix(queue): add Redis database selection support for queue.redis configuration#849

Merged
appleboy merged 2 commits intomasterfrom
copilot/fix-redis-db-specification
Oct 29, 2025
Merged

fix(queue): add Redis database selection support for queue.redis configuration#849
appleboy merged 2 commits intomasterfrom
copilot/fix-redis-db-specification

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

Users cannot specify a Redis database number (other than 0) for the queue engine, despite this being supported for the stat engine and by the underlying redisdb-stream library.

Changes

  • Configuration: Added db field to SectionRedisQueue struct with viper loading support
  • Queue initialization: Pass db parameter to redisdb.NewWorker() via WithDB() option
  • Tests: Added coverage for config file and environment variable loading

Usage

queue:
  engine: "redis"
  redis:
    addr: 127.0.0.1:6379
    db: 5  # Previously forced to 0

Or via environment variable:

GORUSH_QUEUE_REDIS_DB=5

Both queue and stat engines can now use separate Redis databases, enabling better data isolation.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • redis
    • Triggering command: /tmp/go-build904522946/b257/redis.test -test.testlogfile=/tmp/go-build904522946/b257/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>can not specify redis db</issue_title>
<issue_description>can not specify redis db which is not 0</issue_description>

Comments on the Issue (you are @copilot in this section)

@appleboy I will take it.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Add db field to SectionRedisQueue configuration structure
- Update default configuration with queue.redis.db setting (default: 0)
- Update config loading to read queue.redis.db parameter
- Pass db parameter to redisdb.NewWorker in main.go using WithDB option
- Add comprehensive tests for Redis DB configuration
- Update test configuration files with db field

Co-authored-by: appleboy <21979+appleboy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with specifying non-zero Redis database Add Redis database selection support for queue.redis configuration Oct 29, 2025
Copilot AI requested a review from appleboy October 29, 2025 14:46
@appleboy appleboy marked this pull request as ready for review October 29, 2025 14:48
@appleboy appleboy changed the title Add Redis database selection support for queue.redis configuration fix(queue): add Redis database selection support for queue.redis configuration Oct 29, 2025
@appleboy appleboy merged commit db0bf4d into master Oct 29, 2025
11 of 12 checks passed
@appleboy appleboy deleted the copilot/fix-redis-db-specification branch October 29, 2025 14:51
Copilot AI added a commit that referenced this pull request Oct 31, 2025
…iguration (#849)

* Initial plan

* Add Redis DB configuration support for queue.redis

- Add db field to SectionRedisQueue configuration structure
- Update default configuration with queue.redis.db setting (default: 0)
- Update config loading to read queue.redis.db parameter
- Pass db parameter to redisdb.NewWorker in main.go using WithDB option
- Add comprehensive tests for Redis DB configuration
- Update test configuration files with db field

Co-authored-by: appleboy <21979+appleboy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: appleboy <21979+appleboy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can not specify redis db

2 participants