Skip to content

Commit

Permalink
Merge pull request #3184 from LiskHQ/3176-ignore_error_from_redis
Browse files Browse the repository at this point in the history
Lisk Core should start without Redis - Closes #3176
  • Loading branch information
MaciejBaj committed Mar 25, 2019
2 parents 8393bc2 + 80e0540 commit 0a51e7a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions framework/src/components/cache/cache.js
Expand Up @@ -41,17 +41,18 @@ class Cache {
// TODO: implement retry_strategy
// TOFIX: app crashes with FTL error when launchin app with CACHE_ENABLE=true
// but cache server is not available.
const self = this;
return new Promise((resolve, reject) => {
self.client = redis.createClient(self.options);
self.client.once('error', err => {
return new Promise(resolve => {
this.client = redis.createClient(this.options);
this.client.once('error', err => {
// Called if the "error" event occured before "ready" event
self.logger.warn('App was unable to connect to Cache server', err);
return reject(err);
this.logger.warn('App was unable to connect to Cache server', err);
// Error handler needs to exist to ignore the error
this.client.on('error', () => {});
resolve();
});
self.client.once('ready', () => {
self._onReady();
return resolve();
this.client.once('ready', () => {
this._onReady();
resolve();
});
});
}
Expand Down

0 comments on commit 0a51e7a

Please sign in to comment.