Skip to content

Commit

Permalink
FIX: Redis may not be availiable on Redis initializer (discourse#15955)
Browse files Browse the repository at this point in the history
  • Loading branch information
xfalcox authored Feb 15, 2022
1 parent 2644813 commit d83da59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ To get your environment setup, follow the community setup guide for your operati

If you're familiar with how Rails works and are comfortable setting up your own environment, you can also try out the [**Discourse Advanced Developer Guide**](docs/DEVELOPER-ADVANCED.md), which is aimed primarily at Ubuntu and macOS environments.

Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.0+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first!
Before you get started, ensure you have the following minimum versions: [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/), [PostgreSQL 13+](https://www.postgresql.org/download/), [Redis 6.2+](https://redis.io/download). If you're having trouble, please see our [**TROUBLESHOOTING GUIDE**](docs/TROUBLESHOOTING.md) first!

## Setting up Discourse

Expand Down
10 changes: 7 additions & 3 deletions config/initializers/001-redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
# upgrade to Sidekiq 6.1
Redis.exists_returns_integer = true

if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0")
STDERR.puts "Discourse requires Redis 6.2.0 or up"
exit 1
begin
if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0")
STDERR.puts "Discourse requires Redis 6.2.0 or up"
exit 1
end
rescue Redis::CannotConnectError
STDERR.puts "Couldn't connect to Redis"
end

0 comments on commit d83da59

Please sign in to comment.