Here are some ideas to get you started:
- 🔭 I’m currently working on Darabonba.
Async call limit
Home Page: http://html5ify.com/bagpipe
License: Other
Here are some ideas to get you started:
// 队列长度也超过限制值时
if (this.queue.length < this.queueLength || !this.options.refuse) {
this.queue.push({
method: method,
args: args
});
} else {
是不是想说:
// 队列长度不超过限制值时
next() {
// 没到限制,或者没有排队
if (this.active >= this.limit || !this.queue.length) {
return;
}
这里的 没到限制,或者没有排队
是解释下面的 if
语句?说不通啊。
It would be nice if the other part of the world who understand English, be able to read the documentation.
如果任务处理失败,怎么结束所有任务
Line 87 in 6d759c5
这里为什么是根据这个条件来判断是否full
的状态啊??
如果一次性异步读取10个文件,设置了超时时间之后,读取了2个文件,后续8个文件确实超时了,但是只是代码上超时了,实际上IO还是去读取了,读取完成之后还是会调用注入的函数,在arguments中还是存在已经读取出来的文件内容,是否有办法终止这些文件的读取?
npm上的版本貌似还是0.3.5
bagpipe
在 pip install cnpm
时被作为依赖引入,--verbose
的打印显示
npm verb addTmpTarball /tmp/npm-1-9ee1d10d/registry.npmjs.org/bagpipe/-/bagpipe-0.3.5.tgz not in flight; adding
npm verb addTmpTarball already have metadata; skipping unpack for [email protected]
npm verb afterAdd /root/.npm/bagpipe/0.3.5/package/package.json not in flight; writing
npm verb afterAdd /root/.npm/bagpipe/0.3.5/package/package.json written
看上去也没有什么问题,但是就会一直卡在这里,看了下 npm 好像包也不是很大,请问是因为 bagpipe
需要很长的构建时间吗?
if (this.queue.length > 1) {//Todo:为什么大于1个的时候,就提示'full'了呢
this.emit('full', this.queue.length);
}
你好:
我看到你写的真实案例中提到了文件描述符,我想问下文件描述符和数据库连接池有什么关系没,关于你真实案例中的问题,能不能用数据库连接池解决?
一共有100个任务,Bagpipe的并发数设置为5。后面95个任务在队列排队。但前5个任务执行完成后,后面95个任务都没有执行,一致在阻塞。
我限制了并发数5个,为什么不会接着往下执行了。我的期望是,当前5个结束自动开始下5个,或者结束1个开始1个,始终保持最多5个任务。
var bagpipe = new Bagpipe(10);
for (var i = 0; i < 100; i++) {
bagpipe.push(async, function () {
});
}
如果实际控制时这么写,那本质上是不相当于 Bagpipe维护一个了一个队列,限制并发数为最多10个,然后队列长度为100,10个并发处理完成,下10个进入处理,新任务进入队列,是这么理解么
fn1(params , ()=>{
fn2(params , ()=>{
fn3(params , ()=>{
})
})
})
Bagpipe.prototype.push = function (method) {
var args = [].slice.call(arguments, 1);
var callback = args[args.length - 1];
if (typeof callback !== 'function') {
args.push(function () {});
}
[代码。。。]
} else {
var err = new Error('Too much async call in queue');
err.name = 'TooMuchAsyncCallError';
callback(err);
}
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.