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

About redis cluster delete key operation issue suggestion #158

Closed
ericli1018 opened this issue Sep 4, 2016 · 2 comments
Closed

About redis cluster delete key operation issue suggestion #158

ericli1018 opened this issue Sep 4, 2016 · 2 comments

Comments

@ericli1018
Copy link

ericli1018 commented Sep 4, 2016

Hi all,
When I use redis cluster, I found an issue at node_modules/node-resque/lib/worker.js line 386.
I suggested use async to rewrite that delete key operation.
Because on cluster mode, ioredis library can not delete key on different slot at once.
That error message sow below:
"CROSSSLOT Keys in request don't hash to the same slot".

I rewrite some code to fix this issue.

async.each(
    [
        self.connection.key('worker', name, self.stringQueues()),
        self.connection.key('worker', name, self.stringQueues(), 'started'),
        self.connection.key('stat', 'failed', name),
        self.connection.key('stat', 'processed', name)
    ], 
    function iteratee(item, callback){
          self.connection.redis.del( item, function(err){
                callback(err);
            });
    }, 
    function(error){
        if(error){ self.emit('error', null, null, error); }
        if(typeof callback === 'function'){ callback(error); } 
    }
);
@evantahler
Copy link
Member

Great research!
This will be fixed by: #159

@evantahler
Copy link
Member

> npm publish
+ node-resque@3.0.4

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