Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
middlewares
legacy-auth
Commits
26786b94
Commit
26786b94
authored
Jun 23, 2022
by
Sébastien DA ROCHA
Browse files
Merge branch 'master' into 'development'
reactive sentinel en develop See merge request
!22
parents
fd70063f
0934d9ec
Pipeline
#37034
passed with stage
in 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/health/redis.healthIndicator.ts
View file @
26786b94
...
...
@@ -7,7 +7,12 @@ export class RedisHealthIndicator extends HealthIndicator {
async
checkRedisConnection
(
redisConf
:
{
sentinelHost
:
string
,
sentinelPort
:
number
,
groupName
:
string
;
}):
Promise
<
HealthIndicatorResult
>
{
const
client
=
new
IORedis
({
host
:
redisConf
.
sentinelHost
,
port
:
redisConf
.
sentinelPort
});
const
client
=
new
IORedis
({
sentinels
:
[
{
host
:
redisConf
.
sentinelHost
,
port
:
redisConf
.
sentinelPort
},
],
name
:
redisConf
.
groupName
,
});
await
new
Promise
((
resolve
,
reject
)
=>
{
client
.
on
(
'
ready
'
,
resolve
);
...
...
@@ -28,4 +33,4 @@ export class RedisHealthIndicator extends HealthIndicator {
return
this
.
getStatus
(
'
Redis
'
,
true
);
}
}
}
\ No newline at end of file
src/helpers/redis.helper.ts
View file @
26786b94
...
...
@@ -13,7 +13,16 @@ export class Redis {
Logger
.
log
(
`Entering function`
,
`Redis.connect`
);
let
cfg
:
any
=
{
host
:
this
.
redisConfig
.
sentinelHost
,
port
:
this
.
redisConfig
.
sentinelPort
,
name
:
this
.
redisConfig
.
groupName
,
};
if
(
this
.
redisConfig
.
sentinel
){
cfg
=
{
sentinels
:
[
{
host
:
this
.
redisConfig
.
sentinelHost
,
port
:
this
.
redisConfig
.
sentinelPort
},
],
name
:
this
.
redisConfig
.
groupName
,
};
}
const
client
=
new
IORedis
(
cfg
);
...
...
@@ -94,4 +103,4 @@ export class Redis {
handleError
(
error
,
new
InternalServerErrorException
(
'
Couldn
\'
t remove key/value in redis.
'
));
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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