Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mastofe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Haelwenn
mastofe
Commits
20c00544
Commit
20c00544
authored
May 20, 2017
by
Eugen Rochko
Committed by
GitHub
May 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust REDIS_URL usage in node_redis (#3183)
Resolves #2780
parent
ae78d012
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
config/initializers/redis.rb
config/initializers/redis.rb
+2
-1
streaming/index.js
streaming/index.js
+19
-2
No files found.
config/initializers/redis.rb
View file @
20c00544
...
...
@@ -17,8 +17,9 @@ redis_connection = Redis.new(
cache_params
=
{
expires_in:
10
.
minutes
}
namespace
=
ENV
.
fetch
(
'REDIS_NAMESPACE'
)
{
nil
}
if
namespace
Redis
.
current
=
Redis
::
Namespace
.
new
(
namespace
,
:redis
=>
redis_connection
)
Redis
.
current
=
Redis
::
Namespace
.
new
(
namespace
,
redis:
redis_connection
)
cache_params
[
:namespace
]
=
namespace
+
'_cache'
else
Redis
.
current
=
redis_connection
...
...
streaming/index.js
View file @
20c00544
...
...
@@ -41,6 +41,7 @@ const dbUrlToConfig = (dbUrl) => {
}
const
ssl
=
params
.
query
&&
params
.
query
.
ssl
;
if
(
ssl
)
{
config
.
ssl
=
ssl
===
'
true
'
||
ssl
===
'
1
'
;
}
...
...
@@ -48,6 +49,22 @@ const dbUrlToConfig = (dbUrl) => {
return
config
;
};
const
redisUrlToClient
=
(
defaultConfig
,
redisUrl
)
=>
{
const
config
=
defaultConfig
;
if
(
!
redisUrl
)
{
return
redis
.
createClient
(
config
);
}
if
(
redisUrl
.
startsWith
(
'
unix://
'
))
{
return
redis
.
createClient
(
redisUrl
.
slice
(
7
),
config
);
}
return
redis
.
createClient
(
Object
.
assign
(
config
,
{
url
:
redisUrl
,
}));
};
if
(
cluster
.
isMaster
)
{
// Cluster master
const
core
=
+
process
.
env
.
STREAMING_CLUSTER_NUM
||
(
env
===
'
development
'
?
1
:
Math
.
max
(
os
.
cpus
().
length
-
1
,
1
));
...
...
@@ -94,15 +111,15 @@ if (cluster.isMaster) {
port
:
process
.
env
.
REDIS_PORT
||
6379
,
db
:
process
.
env
.
REDIS_DB
||
0
,
password
:
process
.
env
.
REDIS_PASSWORD
,
url
:
process
.
env
.
REDIS_URL
||
null
,
};
if
(
redisNamespace
)
{
redisParams
.
namespace
=
redisNamespace
;
}
const
redisPrefix
=
redisNamespace
?
`
${
redisNamespace
}
:`
:
''
;
const
redisClient
=
redis
.
createClient
(
redisParams
);
const
redisClient
=
redis
UrlToClient
(
redisParams
,
process
.
env
.
REDIS_URL
);
const
subs
=
{};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment