Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Kanban is a node.js control-flow library. As the Japanese methodology, it is pull-based.
Kanban is a node.js control-flow library. As the Japanese methodology, it is pull-based.
Node.js is all about concurrency: the more, the better. If you use external tools, or slow external services, you might reach a point were more concurrency reduce your throughput. You have to do something, and yet you have no data to decide.
Kanban focus is on recording stats and identifying bottlenecks. Then, it helps you improving your system, by specifying a work-in-progress limit to limit the concurrency of a processing step in your app.
npm install kanban --save
As in kanban, there is a Board and the processing of __Job__s happens in __Step__s.
First, you must create a new Board:
var kanban = require("kanban");
var board = new kanban.Board();
Then, you define some tasks:
board.defineStep("fast", { wip: 2 }, function (obj, done) {
console.log("Fast step started for " + obj);
setTimeout(function () {
console.log("Fast step done for " + obj);
done();
}, 1000);
});
board.defineStep("buffer");
board.defineStep("slow", { wip: 1 }, function (obj, done) {
console.log("Slow step started for " + obj);
setTimeout(function () {
console.log("Slow step done for " + obj);
done();
}, 5000);
});
Note that the second and third parameters are optional.
Finally you insert some jobs in the Board:
var print = function (err, job) {
// job is an instance of the Job class
console.dir(job);
};
for (var i = 0; i < 15; i++) {
board.insert(i, print);
}
You can find more examples in the examples folder.
The errors are handled in a pure node.js-style callbacks, so you MUST call the callback with the error as the first parameter.
If an error happens, the job is removed from the board and the function you inserted with the job is called.
instance.defineStep("a", function (obj, job, cb) {
cb(new Error("hello world"));
});
instance.insert({ a: "b" }, function (err) {
console.log(err)
});
It is possible to jump to a specific step in the board:
instance.defineStep("a", { wip: 1 }, function (obj, job, cb) {
job.jumpTo("c");
cb();
}).defineStep("b", { wip: 1 }, function (obj, cb) {
cb(new Error("hello world"));
}).defineStep("c").defineStep("d", function (obj, cb) {
cb();
});
instance.insert({ a: "b" }, function (err) {
console.log(err)
});
It is possible to specify a timeout for a given step, in milliseconds.
If a timeout happens, the job is removed from the board and the function you inserted with the job is called.
// define a timeout of a minute
instance.defineStep("a", { timeout: 60 * 1000 }, function (obj, job, cb) {
// this function is stuck somewhere, it will not complete
});
instance.insert({ a: "b" }, function (err) {
console.log(err)
});
Copyright (c) 2013 Matteo Collina, http://matteocollina.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
Kanban is a node.js control-flow library. As the Japanese methodology, it is pull-based.
We found that kanban 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.