简体   繁体   中英

Node Redis Command Will Not Run?

This is boggling my mind.

I have a BLPOP that triggers the following source code below. When the source is first triggered only the first Redis call gets triggered... the second does not get triggered until there is another pop and the source code is run through again??

null
DEBUG - 8621 - Sat Feb 18 2017 20:47:53 GMT-0600 (CST) - 5 totalConnections 2000
null
DEBUG - 8621 - Sat Feb 18 2017 20:47:54 GMT-0600 (CST) - 5 expectedConnections 500
null
DEBUG - 8621 - Sat Feb 18 2017 20:47:54 GMT-0600 (CST) - 5 totalConnections 2100

Source

const expectedConnectionsKey = ['test', id, 'expectedConnections'].join(':');
const totalConnectionsKey = ['test', id, 'connections'].join(':');
watcher.client.incrby(totalConnectionsKey, connections, (error, totalConnections) => {
    console.log(error);
    log.debug(id, 'totalConnections', totalConnections);
    watcher.client.get(expectedConnectionsKey, (error, expectedConnections) => {
        console.log(error);
        log.debug(id, 'expectedConnections', expectedConnections);
    });
});

Issue was with timing...

I had the blpop on the same channel, and only one of the commands was getting executed before blpop started waiting again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM