Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
breeze-queue
Advanced tools
Readme
Throttled parallel function invocation.
breeze-queue
is available on npm.
$ npm install breeze-queue
breeze-queue
is available as a component.
$ component install qualiancy/breeze-queue
The queue mechanism allows for a any number of data objects to be processed by an iterator when they become available. The queue will processes items in parellel, up to a given concurrently value, then will wait until an item has finished until beginning to process the next. The items queued can have a callback executed when it has completed its iterator.
In addition, a queue may also have
functions attached to listen for specific events.
On such event is an error. Should any item in the queue
fail to process and provide an error to it's next
callback, no further items will be processed.
var Queue = require('breeze-queue');
var queue = Queue(function (obj, next) {
setTimeout(next, 10);
}, 5);
Property indicating the number of items current in the queue. An item is removed from this list prior to being processed.
You can push an item or an array of items into
the queue for processing. The callback will be
called for the completion of each item if the queue
has not entered into an error state. A autostart
boolean my also be provided if you wish to start
processing the queue with this push of items. If
no pushes provide the autostart, then the queue
must be started manually with .process()
.
Note that if the queue has already been started but
has been drained of items, it will not start again
with another push unless the autostart
toggle is present.
// single item
queue.push({ hello: 'universe' });
// multiple items
queue.push([
{ hello: 'world' }
, { hello: 'universe' }
]);
// notify callback
queue.push({ hello: 'universe' }, notify);
// autostart
queue.push({ hello: 'universe' }, true);
// notify + autostart
queue.push({ hello: 'univeerse' }, notify, true);
Begin the queue processing cycle. Has no impact if the queue is already processing.
queue.process();
Setting this to a function will provide a listener should an error occur. It will not be executed otherwise.
queue.onerror = function (err) {
console.error(err.message);
};
This listener will be executed when the number of queued items exceeds the current concurrency value. This will be executed directly after the push of said items.
queue.saturated = function () {
console.log('the queue is saturated');
};
This listener will be executed when the queue is empty. In other words, prior to the last item in the queue being processed.
queue.empty = function () {
console.log('the queue is on the last item');
};
This listener will be executed when all queued items have been executed through the iterator.
queue.drain = function () {
console.log('the queue has processed all tiems');
};
(The MIT License)
Copyright (c) 2012 Jake Luer jake@qualiancy.com (http://qualiancy.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Throttled parallel function invocation.
The npm package breeze-queue receives a total of 2,234 weekly downloads. As such, breeze-queue popularity was classified as popular.
We found that breeze-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.