Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OfflineQueue - configuration to turn on and off #40

Open
youngamichael opened this issue Jul 16, 2018 · 4 comments
Open

OfflineQueue - configuration to turn on and off #40

youngamichael opened this issue Jul 16, 2018 · 4 comments

Comments

@youngamichael
Copy link

First off, I like this library. I wish there was a configuration for the offline queue feature to shut it off. When you call send and redis is down it pushes the message into the offline queue. The problem I see with that is redis could be down for a while and you have a potential to back up fairly significantly. It isn't written to disk so if the program would crash those messages would be lost. In some cases the offline queue maybe very useful but I wish there was a configuration option to just callback with an error so further steps could be taken upstream.

@rogerweb
Copy link

rogerweb commented Jul 16, 2018

I think you missed the answer, so here it goes:

smrchy/rsmq#80 (comment)

Regards,

Roger

@youngamichael
Copy link
Author

I may be mistaken but it appears that rsmq-worker implements it's own offline_queue. I couldn't see anywhere in the node-redis library where the enable_offline_queue setting effects the queue.connected property.

Code from my node_modules folder.

  RSMQWorker.prototype.send = function() {
      var args, cb, delay, msg;
      msg = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
      delay = args[0], cb = args[1];
      if (_isFunction(delay)) {
        cb = delay;
        delay = null;
      }
      if (delay == null) {
        delay = this.config.defaultDelay;
      }
      if (this.queue.connected) {
        this._send(msg, delay, cb);
      } else {
        this.debug("store message during redis offline time", msg, delay);
        this.offlineQueue.push({
          msg: msg,
          delay: delay,
          cb: cb
        });
      }
      return this;
    };

@rogerweb
Copy link

I just ran a quick test here and, although the redis client supports the flag enable_offline_queue, it looks rsmq and/or rsmq-worker don't work if you set it to false, no matter if you set it as an option of the redis client itself or under options.options of the rsmq or under options.options of the rsmq-worker or any other way you chain the creation of these three objects.

So I'll leave it to @mpneuried and @smrchy.

Cheers,

Roger

@youngamichael
Copy link
Author

Now I wonder if the offline queue feature should just be removed and just lean on the node-redis offline queue. Either way I would appreciate the ability to turn it off and just let it fail. If I get some time I might submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants