Commit 9734b8bb authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-already-initialized-constant' into 'master'

Don't require Gitlab::Redis in mail_room.yml if it's already defined

## What does this MR do?

Avoid requiring `lib/gitlab/redis.rb` if `Gitlab::Redis` is already defined.

## Are there points in the code the reviewer needs to double check?

No.

## Why was this MR needed?

Because otherwise you get `already initialized constant Gitlab::Redis::XXX`, e.g.:

```
› bin/rspec spec/config/mail_room_spec.rb
Running via Spring preloader in process 24658
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:3: warning: already initialized constant Gitlab::Redis::CACHE_NAMESPACE 
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:3: warning: previous definition of CACHE_NAMESPACE was here
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:4: warning: already initialized constant Gitlab::Redis::SESSION_NAMESPACE
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:4: warning: previous definition of SESSION_NAMESPACE was here
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:5: warning: already initialized constant Gitlab::Redis::SIDEKIQ_NAMESPACE
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:5: warning: previous definition of SIDEKIQ_NAMESPACE was here
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:12: warning: already initialized constant Gitlab::Redis::URL_MUTEX
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:12: warning: previous definition of URL_MUTEX was here
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:13: warning: already initialized constant Gitlab::Redis::POOL_MUTEX
/Users/remy/Code/GitLab/gdk/gitlab/lib/gitlab/redis.rb:13: warning: previous definition of POOL_MUTEX was here
 2/2 |================================================= 100 =================================================>| Time: 00:00:00 

Finished in 0.38505 seconds (files took 0.48292 seconds to load)
2 examples, 0 failures
```

## What are the relevant issue numbers?

None!

## Does this MR meet the acceptance criteria?

- [x] ~~[CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added~~ Not needed.
- [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ Not needed.
- [x] ~~API support added.~~ Not needed.
- [x] ~~Tests.~~ Not needed.
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4586
parents cfc99bbd 72647eda
......@@ -2,7 +2,7 @@
<%
require "yaml"
require "json"
require_relative "lib/gitlab/redis"
require_relative "lib/gitlab/redis" unless defined?(Gitlab::Redis)
rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment