Comments (2)
Being a non-blocking queue it will allow the caller to continue submitting tasks up to the limit of the memory. When using WorkerPool if there is a chance of submitting more tasks that can be safely stored in memory, then there should be some means (outside of workerpool) to stop submitting tasks before this limit.
A modified WorkerPool could be given a limit to the number of queued tasks it will enqueue and then handle additional submissions by blocking or by discarding tasks. The reason that WorkerPool does not handle this is that these functionalities can be added by the caller, and how they are handled are likely application-specific.
In the case of the blocking queue, the application can determine when it is in a low-resource condition and then stop submitting new tasks while the condition persists. Or, if limiting the queued tasks, can stop submitting more until the number of incomplete tasks decreases.
In the case of discarding, what to discard is going to be up to the application (oldest, random, lowest priority, etc.) The task function itself, or a task function wrapper, would check the discard condition and exit immediately if it is discarded, possibly sending a notification that it was discarded.
from workerpool.
ok,thanks
from workerpool.
Related Issues (20)
- Race condition testing HOT 3
- Stop job while running HOT 20
- Pause a workerpool through keyboard HOT 16
- How to avoid task queueing (handling priority) HOT 2
- support to change maxWorkers dynamically HOT 2
- codecov in .travis.yml - security issue HOT 1
- Possible memory leak HOT 8
- Document how to handle errors, please HOT 2
- Why startWorker() and not worker()? HOT 2
- [feature request] naming workerpools
- Ability configure idle timeout. HOT 1
- Cannot work with deque 0.2.0 HOT 1
- What is the purpose of "r := r"? HOT 2
- Make Workers open and close a database connection HOT 3
- Bug - strange behavior HOT 1
- Wait on Submit until queue has HOT 1
- required: update golang version
- run in background
- Race between Submit and Stop
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workerpool.