Преглед на файлове

fix: redis createClient call

version-14
Faris Ansari преди 4 години
родител
ревизия
c5c50c290e
променени са 2 файла, в които са добавени 5 реда и са изтрити 12 реда
  1. +3
    -3
      esbuild/utils.js
  2. +2
    -9
      node_utils.js

+ 3
- 3
esbuild/utils.js Целия файл

@@ -111,12 +111,12 @@ function log(...args) {
}

function get_redis_subscriber(kind) {
// get redis subscriber that aborts after 50 connection attempts
// get redis subscriber that aborts after 10 connection attempts
let { get_redis_subscriber: get_redis } = require("../node_utils");
return get_redis(kind, {
retry_strategy: function(options) {
// abort after 50 connection attempts
if (options.attempt > 50) {
// abort after 10 connection attempts
if (options.attempt > 10) {
return undefined;
}
return Math.min(options.attempt * 100, 2000);


+ 2
- 9
node_utils.js Целия файл

@@ -38,17 +38,10 @@ function get_conf() {
return conf;
}

function get_redis_subscriber(kind="redis_socketio", options=null) {
function get_redis_subscriber(kind="redis_socketio", options={}) {
const conf = get_conf();
const host = conf[kind] || conf.redis_async_broker_port;

if (options) {
return redis.createClient({
host,
...options
});
}
return redis.createClient(host);
return redis.createClient({ url: host, ...options });
}

module.exports = {


Зареждане…
Отказ
Запис