From 17ae5ae83f5b6d234a9fab065044c327eb954512 Mon Sep 17 00:00:00 2001 From: Travis Sheldon Date: Tue, 22 Nov 2022 09:24:15 -0500 Subject: [PATCH] Update index.js (#26) switch from using this.redis_pings in favor of this.redis_ping(), related to #23 --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6347587..d44509e 100644 --- a/index.js +++ b/index.js @@ -106,10 +106,12 @@ exports.rcpt = async function (next, connection, params) { } // if we can't use redis, try files - if (!this.redis_pings) { + if (!!this.db && ! await this.redis_ping() ) { return next(await this.do_file_search(txn, address, domain)); } + + // redis connection open, try it next(await this.do_redis_search(connection, address, domain)) } @@ -164,7 +166,7 @@ exports.get_mx = async function (next, hmail, domain) { } // if we can't use redis, try files and return - if (!this.redis_pings) { + if (!! this.db && ! await this.redis_ping() ) { this.get_mx_file(address, domain, next); return; }