-
Notifications
You must be signed in to change notification settings - Fork 41
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
Should it be possible to call close
more than once?
#57
Comments
I'm 👎 . It should error on the second time (in the callback, reject in the promise). I probably added that part in a haste. That whole logic could be simplified. |
close
more than twice?close
more than once?
I'm 👎 too We should remove the queue mechanism in |
@mcollina in the current state a second 'use strict'
const avvio = require('.')()
avvio
.ready(function () {
console.log('application booted!')
avvio.onClose((context, done) => {
done(new Error('test'))
})
avvio.close((err, cb) => {
console.log(err, '1111') // error, '1111'
cb(err)
})
avvio.close((err) => {
console.log(err, '2222') // null '2222'
})
}) We could release it as bugfix when we adjust the code as @delvedor #56 (comment) suggested because the err must be handled by the user since the start. WDYT? |
As the next step, we could remove the queue completely and this would be a major change. |
Do you working on this or can I create a PR? |
go ahead and create a PR!
Il giorno gio 5 apr 2018 alle 22:19 Dustin Deus <[email protected]>
ha scritto:
… Do you working on this or can I create a PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#57 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADL46CCeD-GLQ7YlKlAXgk04-mqH1l5ks5tlnxUgaJpZM4TCa_7>
.
|
My plan would be: Round 1
Round 2
|
Why remove the
Maybe I'm missing something here. What do you mean? In my opinion call |
For me, it's wrong that
It should only allow setting a single callback like avvio.close(() => {}) // OK
avvio.close(() => {}) // error: close was already called so, in that case, we don't need a queue. |
I strongly suggest you to moderate your tone.
There is not difference between the |
Don't be so pedantic! This is a technical discussion and I just make my point clear.
Then you will mix up again two different things starting and closing. As a user, I expect that |
Again.
It is not a matter of mixing up, in theory a user should not call |
|
WDYT? |
This should work:
We need to call |
Discussed first in #56
The text was updated successfully, but these errors were encountered: