Skip to content

Commit

Permalink
fix: Stop crashing when redis is offline and ignoreErrors on cache op…
Browse files Browse the repository at this point in the history
…tions is set
  • Loading branch information
mesinger committed Mar 6, 2022
1 parent f3cfdd2 commit 72c836d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cache/RedisQueryResultCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export class RedisQueryResultCache implements QueryResultCache {
...cacheOptions?.options,
legacyMode: true
});
if (typeof this.connection.options.cache === "object" && this.connection.options.cache.ignoreErrors) {
this.client.on("error", (err: any) => {
this.connection.logger.log("warn", err);
});
}
if ("connect" in this.client) {
await this.client.connect();
}
Expand Down

0 comments on commit 72c836d

Please sign in to comment.