Add functionality to AsyncProgressWorker::Execute to schedule future call to itself
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 531
- Avg merge
- 21m
- Merged PRs (30d)
- 1
Description
I have a very particular usecase which goes as follows,
I have a node app running HTTP server and has a C++ bindings for some video related work. The resources served by the server hook to NAN APIs of C++ code which start infinitely long running tasks. e.g. NAN API to startProcessing will read video from an RTP source and process it until stopped. This uses gstreamer and its running on a thread outside node threadpool.
I also have requirement to know status update on this operation and so pass a JS callback to the API startProcessing(onStatusUpdateCb).
I am making use of AsyncProgressWorker at the moment to achieve this long running and multiple async callback relation between C++ and JS. I queue the worker using AsyncQueueWorker() which runs Execute on one of the available worker threads (correct me if I am wrong).
my Execute function keeps monitoring a global queue for any status updates from my gstreamer thread in a while(1) loop and calls Send when the queue is not empty.
This makes one worker thread always blocked in a while (1) loop. Is there any better way to implement my requirements? or else it would be very handy to have an API in AsyncProgressWorker to schedule future calls to Execute with a timeout. This will remove the need for while(1) loop and will also relinquish the worker thread permanently held for monitoring.
Feel free to point out any obvious mistakes in the design.
Regards,
Ameya
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names AsyncProgressWorker::Execute, AsyncQueueWorker(), Send, and the startProcessing callback flow, but no files or tests. Start by reading those APIs and the described gstreamer-thread interaction; done requires an agreed non-blocking scheduling design and corresponding documented behavior or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, nodejs
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100