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

thekdar

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thekdar - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

yarn.lock

1

core/events.js

@@ -5,2 +5,3 @@ module.exports = {

TASK_REMOVE: 'task:remove',
TASK_STOP: 'task:stop',
TASK_COMPLETE: 'task:complete',

@@ -7,0 +8,0 @@ WORKER_CREATE: 'worker:create',

@@ -30,2 +30,7 @@ const uuid = require('uuid');

}
getWorkerId() {
return this._workerId
}
getId() {

@@ -32,0 +37,0 @@ return this.id;

@@ -9,3 +9,2 @@ const uuid = require('uuid');

const Worker = require('./Worker');
const differenceInMinutes = require('date-fns/difference_in_minutes');

@@ -222,3 +221,3 @@ class Thekdar extends EventEmitter {

const workerTask = this._workerTaskLookup.get(tempWorkerId);
const indexOfTask = workerTask.findIndex(id => taskId);
const indexOfTask = workerTask.findIndex(id => id === taskId);
if (indexOfTask > -1) {

@@ -292,2 +291,10 @@ workerId = tempWorkerId;

}
stopTask(taskId) {
const task = this._tasks.get(taskId);
const worker = this._workers.get(task.getType()).get(task.getWorkerId());
worker.send(events.TASK_STOP, task);
debug(`Task stopped: ${taskId}`);
this.removeTask(taskId);
}
}

@@ -294,0 +301,0 @@ Thekdar.MAX_TASK_PER_WORKER = 10;

27

examples/types/fork.js

@@ -0,12 +1,23 @@

const { events } = require('../../index');
process.on('message', data => {
// console.log(data);
setTimeout(() => {
process.send({
type: 'task:complete',
taskId: data.task.id,
workerId: data.workerId,
data: {},
});
}, Math.round(Math.random() * 5000) + 3000);
switch (data.type) {
case events.TASK_ADD:
timer = setTimeout(() => {
process.send({
type: 'task:complete',
taskId: data.task.id,
workerId: data.workerId,
data: {},
});
}, Math.round(Math.random() * 5000) + 3000);
break;
case events.TASK_STOP:
clearTimeout(timer);
break;
default:
break;
}
});
{
"name": "thekdar",
"version": "1.0.5",
"version": "1.0.6",
"description": "",

@@ -14,3 +14,2 @@ "main": "index.js",

"better-queue": "^3.8.7",
"date-fns": "^1.29.0",
"debug": "^3.1.0",

@@ -17,0 +16,0 @@ "respawn": "^2.5.0",

@@ -5,2 +5,7 @@ # Thekdar [![Build Status](https://travis-ci.org/savetodrive/thekdar.svg?branch=master)](https://travis-ci.org/savetodrive/thekdar)

# Getting Started for contribution
- Clone this repo
- Run `npm install`
- Run `npm t` to see how it works
# Example

@@ -7,0 +12,0 @@

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