Bladeren bron

fix: redis createClient call

version-14
Faris Ansari 4 jaren geleden
bovenliggende
commit
c5c50c290e
2 gewijzigde bestanden met toevoegingen van 5 en 12 verwijderingen
  1. +3
    -3
      esbuild/utils.js
  2. +2
    -9
      node_utils.js

+ 3
- 3
esbuild/utils.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 = {


Laden…
Annuleren
Opslaan