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

redis-smq-common

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-smq-common - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/src/worker/worker-error.d.ts

7

CHANGELOG.md
# CHANGELOG
## 1.0.1 (2022-07-07)
* Remove unused WorkerRunnerError (48e7206)
* Use namespaced WorkerError (517224c)
* Make array looping asynchronous (cd66e51)
* Run workers one by one without a delay (099b488)
## 1.0.0 (20220-06-18)

@@ -4,0 +11,0 @@

14

dist/src/async/async.js

@@ -13,3 +13,3 @@ "use strict";

else
iterate();
setTimeout(() => iterate(), 0);
});

@@ -34,3 +34,3 @@ };

else
iterate();
setTimeout(() => iterate(), 0);
});

@@ -58,6 +58,8 @@ };

else if (idx < tasks.length) {
if (args.length)
tasks[idx](...args, exec);
else
tasks[idx](exec);
setTimeout(() => {
if (args.length)
tasks[idx](...args, exec);
else
tasks[idx](exec);
}, 0);
}

@@ -64,0 +66,0 @@ else if (args.length) {

@@ -5,4 +5,2 @@ import { Worker } from '../worker';

private pool;
private index;
private getCurrentPoolItem;
work: (cb: ICallback<void>) => void;

@@ -9,0 +7,0 @@ add: (worker: Worker) => number;

@@ -8,18 +8,7 @@ "use strict";

this.pool = [];
this.index = 0;
this.getCurrentPoolItem = () => {
this.work = (cb) => {
if (this.pool.length) {
const worker = this.pool[this.index];
this.index += 1;
if (this.index >= this.pool.length) {
this.index = 0;
}
return worker;
const tasks = this.pool.map((worker) => (cb) => worker.work(cb));
async_1.async.waterfall(tasks, cb);
}
return null;
};
this.work = (cb) => {
const worker = this.getCurrentPoolItem();
if (worker)
worker.work(cb);
else

@@ -37,3 +26,2 @@ cb();

this.pool = [];
this.index = 0;
cb();

@@ -40,0 +28,0 @@ });

@@ -7,3 +7,3 @@ "use strict";

const power_manager_1 = require("../power-manager/power-manager");
const panic_error_1 = require("../errors/panic.error");
const worker_error_1 = require("./worker-error");
class Worker {

@@ -15,3 +15,3 @@ constructor(managed, timeout = 1000) {

if (!this.ticker) {
throw new panic_error_1.PanicError(`Expected an instance of Ticker`);
throw new worker_error_1.WorkerError(`Expected an instance of Ticker`);
}

@@ -29,3 +29,3 @@ return this.ticker;

if (this.managed) {
throw new panic_error_1.PanicError('You can not run a managed worker');
throw new worker_error_1.WorkerError('You can not run a managed worker');
}

@@ -60,3 +60,3 @@ const powerManager = this.getPowerManager();

if (!this.powerManager) {
throw new panic_error_1.PanicError('Expected an instance of PowerManager');
throw new worker_error_1.WorkerError('Expected an instance of PowerManager');
}

@@ -63,0 +63,0 @@ return this.powerManager;

{
"name": "redis-smq-common",
"version": "1.0.0",
"version": "1.0.1",
"description": "RedisSMQ shared components that may be used by integrated applications and extensions.",

@@ -5,0 +5,0 @@ "author": "Weyoss <weyoss@protonmail.com>",

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