We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
.on(name, handler)
From verison 2.0 - The .on(name:string, handler:function):this API from EventListener now returns a promise.
.on(name:string, handler:function):this
EventListener
this breaks the chaining API, because it returns a Promise, which I could not figure what it resolves to - because it does not resolve... 🤔...
I see that .emit(name, payload) also returns a promise...
.emit(name, payload)
The code that it breaks for me is in the spirit of:
new Promise( (accept, reject) => mgr.client = c = redis(redisOptions) .on('error', reject) .on('connect', () => c.removeListener('error', reject) && accept(c)), )
I tried to play with it in shell, this is what I managed to isolate:
Welcome to Node.js v20.11.0. Type ".help" for more information. > c = require('async-redis').createClient();1 1 > c.on('error', (v, done) => console.log('Err', v) || done()).then(() => console.log('--> on resolved')); Promise { <pending>, [Symbol(async_id_symbol)]: 96, [Symbol(trigger_async_id_symbol)]: 95 } > c.emit('error', {code:1}).then(() => console.log('--> emit resolved')); Err { code: 1 } Promise { <pending>, [Symbol(async_id_symbol)]: 117, [Symbol(trigger_async_id_symbol)]: 115 } > --> emit resolved >
I get it with emit although it breaks the EventHandler API... I would have gone with asyncEmit or something, but that's workable.
emit
asyncEmit
But - 🤔 I don't get it, why on should return a promise, and if it does - why won't it resolve?
on
the current state is not workable...
The text was updated successfully, but these errors were encountered:
I also see that client.serverInfo.redis_version and such have moved to __redisClient.serverInfo.redis_version
client.serverInfo.redis_version
__redisClient.serverInfo.redis_version
is there a stated accessor to the server info I should use, or is it legit to access __redicClient for that?
__redicClient
Sorry, something went wrong.
anybody home?
🤔
No branches or pull requests
From verison 2.0 -
The
.on(name:string, handler:function):this
API fromEventListener
now returns a promise.this breaks the chaining API, because it returns a Promise, which I could not figure what it resolves to - because it does not resolve... 🤔...
I see that
.emit(name, payload)
also returns a promise...The code that it breaks for me is in the spirit of:
I tried to play with it in shell, this is what I managed to isolate:
I get it with
emit
although it breaks the EventHandler API...I would have gone with
asyncEmit
or something, but that's workable.But - 🤔 I don't get it, why
on
should return a promise, and if it does - why won't it resolve?the current state is not workable...
The text was updated successfully, but these errors were encountered: