rknell / dart_queue Goto Github PK
View Code? Open in Web Editor NEWA library to easily handle sequential queueing of futures in dart.
License: MIT License
A library to easily handle sequential queueing of futures in dart.
License: MIT License
I am getting error if I user import path as
import "package:dart_queue/dart_queue.dart";
It is resolved by keeping path as
import "package:queue/queue.dart";
It would be nice to get a method to insert a new element at the front of the queue vs. only adding items to the end.
Hi, thanks for this useful plugin!
Would it be possible to add a way to wait on all futures before disposing? I'm using this to queue writes to a file, so it'd be quite helpful as it's important data that needs to be written.
After the queue calls the cancel method, it cannot re-add a new future to the queue because a QueueCancelledException will be reported after adding it. So how can I stop the queue better?
`class FutureQueueService {
static final FutureQueueService _singleton = FutureQueueService._internal();
factory FutureQueueService() {
return _singleton;
}
FutureQueueService._internal() {
queue = Queue();
final remainingItemsStream = queue.remainingItems
.listen((numberOfItems) => log('numberOfItems $numberOfItems'));
}
}`
The queue is able to complete all the future task one-by-one, but the stream is not begin called atall.
The log isnt getting printed.
Can you explain why you're using this piece of code to execute _process()
method?
void unawaited(Future<void> future) {}
If i for example have five items remaining in the queue is there any way to insert a new future into for example a second position?
And thanks for the package, it's really useful!
I used queue to wait for all requests finished like this:
var queue = Queue(parallel: 4);
for (final item in items) {
if(valid(item)) {
queue.add(() => _sendRequest(item));
}
}
await queue.onComplete;
print('completed');
For some reasons, if there is no valid item in for loop, the queue is empty. And in this case it pauses at await queue.onComplete
forever.
Expect: it should allow to go through next line if queue is empty.
Hi @rknell, what is the status of the package? Are you actively maintaining it, looking for contributors or something else?
I noticed that there was no activity in the last months, should we guess that the gin distillery is taking more time than expected?
Let us know what kind of support you need here, if any, and/or what is the plan for this package.
All the best ๐
In combination with #6, a way to limit the queue in size would be helpful as well.
This may be trickier to achieve if items are added from both sides.
Hello, I am implementing this library with the video thumbnail, but I have a problem, which is that sometimes the same element is called 2 times, causing an unnecessary queue to be generated, so I would like for example:
The queue ignores the stackTrace and doesn't pass it to the completer.
dart_queue/lib/src/dart_queue_base.dart
Lines 36 to 38 in 77ab859
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.