Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thekdar

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thekdar

Thekdar is module which will manage node child process , it will help us creating workers, distribute task across workers, kill workers or limit there work

  • 1.0.1
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Thekdar Build Status

Thekdar is module which will manage node child process , it will help us creating workers, distribute task across workers, kill workers or limit there work

Example

const Thekdar = require("thekdar");
const events = Thekdar.events;
const Task = Thekdar.Tasks;

// Create new thekdar object
const thekdar = new Thekdar();

// Path of script to be executed and type of worker
    thekdar.addWorkerAddress(
      "./core/workers/fork.js",
       Task.TYPE_FORK
    );


  handleJobs(data, done) {
    // Create new task from Task class
    const task = new  Task();

    task.setData(data);

    // Set type of task like (fork, spawn)
    task.setType(Task.TYPE_FORK);

    try {
      // add task to thekdar
      const add = thekdar.addTask(task);

    } catch (error) {
      logger.error(error);
      logger.error(`Unable to completed job,
      Workers ${thekdar.getWorkers().size},
      tasks ${thekdar.getTasks().size}`);
      return done(error);
    }
  }

  _handleThekdarMessages() {
     thekdar.on("message", data => {
      switch (data.type) {
        case events.TASK_ERROR:
          break;
        case events.TASK_COMPLETE:
        case events.TASK_REMOVE:
          console.log(thekdar.getWorkers().size);
          console.log(thekdar.getTasks().size);
           break;
      }
    });
  }

FAQs

Package last updated on 11 Apr 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc