nan icon indicating copy to clipboard operation
nan copied to clipboard

ExecutionProgress::SendProgress_ overwrites previous values

Open jopann opened this issue 8 years ago • 2 comments

When ExecutionProgress::Send() is invoked quickly to deliver data on repeated callbacks the previous data values are overwritten by the code line below. This results in only the latest data being delivered via a callback to JavaScript.

https://github.com/nodejs/nan/blob/137bd5ae2d47064d44791a094582d97ca0e1b8bb/nan.h#L1683

It was not clear to me if this is the design of the AsyncProgressWorker or not? I didn't expect it. Also, do you guys have an IRC channel?

jopann avatar Feb 14 '17 19:02 jopann

Yes, it's by design. If you want queue-like behavior, you could write something on top of AsyncWorker.

We could make the behavior a configurable trait when inheriting from AsyncProgressWorkerBase. No strong opinion on whether it's something we should do but it's an option.

IRC: I don't know, I don't hang out on IRC much myself these days. You can probably find some knowledgeable people in #node-dev on freenode.

bnoordhuis avatar Feb 15 '17 17:02 bnoordhuis

I like the idea of a configurable trait. If someone were to write a good implementation as a pull request, I would be happy to merge it.

The current documentation should state that AsyncProgressWorker is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar.

On February 15, 2017 7:12:40 PM GMT+02:00, Ben Noordhuis [email protected] wrote:

Yes, it's by design. If you want queue-like behavior, you could write something on top of AsyncWorker.

We could make the behavior a configurable trait when inheriting from AsyncProgressWorkerBase. No strong opinion on whether it's something we should do but it's an option.

IRC: I don't know, I don't hang out on IRC much myself these days. You can probably find some knowledgeable people in #node-dev on freenode.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/nodejs/nan/issues/642#issuecomment-280074002

kkoopa avatar Feb 15 '17 17:02 kkoopa