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

@wireapp/priority-queue

Package Overview
Dependencies
Maintainers
7
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wireapp/priority-queue - npm Package Compare versions

Comparing version 1.6.17 to 1.6.18

12

package.json
{
"dependencies": {
"@types/node": "~14",
"logdown": "3.3.1",
"uuidjs": "4.2.6"
"@types/node": "~14"
},
"devDependencies": {
"@types/karma": "5.0.1",
"cross-env": "7.0.2",
"cross-env": "7.0.3",
"del-cli": "3.0.1",
"jasmine": "3.5.0",
"jasmine": "3.6.3",
"karma": "5.2.3",

@@ -44,4 +42,4 @@ "karma-chrome-launcher": "3.1.0",

},
"version": "1.6.17",
"gitHead": "d41ad671027086ad79dea3efe4f200ee42d106cf"
"version": "1.6.18",
"gitHead": "baedbbcdfd9da16b1f07fc4dd6af6497f14c2518"
}

@@ -5,3 +5,2 @@ import { Item } from './Item';

export declare class PriorityQueue {
private readonly logger;
private readonly config;

@@ -8,0 +7,0 @@ private isRunning;

@@ -29,8 +29,4 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PriorityQueue = void 0;
const logdown_1 = __importDefault(require("logdown"));
const Item_1 = require("./Item");

@@ -40,6 +36,2 @@ const Priority_1 = require("./Priority");

constructor(config) {
this.logger = logdown_1.default('@wireapp/priority-queue/PriorityQueue', {
logger: console,
markdown: false,
});
this.config = {

@@ -63,16 +55,15 @@ comparator: (a, b) => {

return new Promise((resolve, reject) => {
const queueObject = new Item_1.Item();
queueObject.fn = thunkedPromise;
queueObject.label = label;
queueObject.priority = priority;
queueObject.reject = reject;
queueObject.resolve = resolve;
queueObject.retry = 0;
queueObject.timestamp = Date.now() + this.size;
this.queue.push(queueObject);
const item = new Item_1.Item();
item.fn = thunkedPromise;
item.label = label;
item.priority = priority;
item.reject = reject;
item.resolve = resolve;
item.retry = 0;
item.timestamp = Date.now() + this.size;
this.queue.push(item);
this.queue.sort(this.config.comparator);
if (!this.isRunning) {
this.isRunning = true;
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.processList();
void this.processList();
}

@@ -101,4 +92,4 @@ });

return __awaiter(this, void 0, void 0, function* () {
const queueObject = this.first;
if (!queueObject) {
const item = this.queue.shift();
if (!item) {
this.isRunning = false;

@@ -108,18 +99,14 @@ return;

try {
queueObject.resolve(yield queueObject.fn());
this.queue.shift();
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.processList();
item.resolve(yield item.fn());
void this.processList();
}
catch (error) {
if (queueObject.retry >= this.config.maxRetries) {
this.queue.shift();
queueObject.reject(error);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.processList();
if (item.retry >= this.config.maxRetries) {
item.reject(error);
void this.processList();
}
else {
this.logger.log(`Retrying item "${queueObject}"`);
setTimeout(() => this.processList(), this.getGrowingDelay(queueObject.retry));
queueObject.retry++;
this.queue.push(item);
setTimeout(() => this.processList(), this.getGrowingDelay(item.retry));
item.retry++;
}

@@ -126,0 +113,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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