mmomtchev / queue Goto Github PK
View Code? Open in Web Editor NEWasync/await-compatible Promise-based priority queues
License: MIT License
async/await-compatible Promise-based priority queues
License: MIT License
Hi, this is such an amazing project, thank you!
I wanted to know if there was a way to wait indefinitely until a job is completed before moving to the next in queue? Currently just setting it to a really large number does the job, but it just seems there is probably a better way that I'm missing.
I need this because I use this to write to a file on any state change, and it can result in overwriting issues sometimes if multiple file saves are called at the same time.
Again thank you for an amazing project!
How can i use this in browser
Your readme excited me because it says, I use it with tens of thousands of jobs on the queue.
However, I tried adding 10,400 items to the queue and got RangeError: Too many elements passed to Promise.all
. I am using the 1.2 syntax (second example in your README). Is there a different approach required for larger queues?
Not an issue. Just wanted to say thanks. This is a really great algorithm you've published here! Exactly what I needed and it worked right out of the box.
Thank you for this package.
The example code "running sequentially" seems incomplete to me. Could you take a look ?
Thanks !
Hi! This project looks super promising for my needs, and I love the minimum dependencies, but I have a feeling it's missing 1 crucial piece
The project I'm working on right now allows for users to request a batch of PDFs, package them up into a zip, and get later for download
I can make great use of this package to simplify the very asynchronous nature of this workflow on our server, but I don't see anything about removing a waiting request in the queue
say I have a queue with 10 requests, which won't resolve in an hour or so and decide 10 minutes after making my request I don't actually want that export anymore so I send another request to cancel my last request
wait()
and end()
make use of a hash to keep track of a request in the queue. Could this hash be used to remove that request from the queue later, assuming it's not currently executing?
It looks like the type definition for QueueStats
interface is incorrect.
index.d.ts contains the following definition:
export interface QueueStats {running: {number}, waiting: {number}, last: {number}}
this type means that the running
, waiting
and last
property are all objects with a property inside them called number
and a type of any
. However looking at the code I think each of those should simply be of type number
, like so:
export interface QueueStats {
running: number;
waiting: number;
last: number;
}
while using v2.1.4
const {Queue} = require('async-await-queue');
const myq = new Queue(1, 100);
TypeError: Queue is not a constructor
"typescript": "~4.9.5"
Works with v1.2.1
saw diff in index.d.ts
in 2.1.4 export declare class Queue .... is used
in 1.2.1 export class Queue ... is used
saw Andre Pena's answer. He thinks its of no use
https://stackoverflow.com/questions/35019987/what-does-declare-do-in-export-declare-class-actions
thanks
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.