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

fastq

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastq - npm Package Compare versions

Comparing version 1.17.1 to 1.18.0

SECURITY.md

2

package.json
{
"name": "fastq",
"version": "1.17.1",
"version": "1.18.0",
"description": "Fast, in memory work queue",

@@ -5,0 +5,0 @@ "main": "queue.js",

@@ -291,15 +291,15 @@ 'use strict'

function drained () {
if (queue.idle()) {
return new Promise(function (resolve) {
resolve()
var p = new Promise(function (resolve) {
process.nextTick(function () {
if (queue.idle()) {
resolve()
} else {
var previousDrain = queue.drain
queue.drain = function () {
if (typeof previousDrain === 'function') previousDrain()
resolve()
queue.drain = previousDrain
}
}
})
}
var previousDrain = queue.drain
var p = new Promise(function (resolve) {
queue.drain = function () {
previousDrain()
resolve()
}
})

@@ -306,0 +306,0 @@

@@ -249,1 +249,44 @@ 'use strict'

})
test('drained should resolve after async tasks complete', async function (t) {
const logs = []
async function processTask () {
await new Promise(resolve => setTimeout(resolve, 0))
logs.push('processed')
}
const queue = buildQueue(processTask, 1)
queue.drain = () => logs.push('called drain')
queue.drained().then(() => logs.push('drained promise resolved'))
await Promise.all([
queue.push(),
queue.push(),
queue.push()
])
t.deepEqual(logs, [
'processed',
'processed',
'processed',
'called drain',
'drained promise resolved'
], 'events happened in correct order')
})
test('drained should handle undefined drain function', async function (t) {
const queue = buildQueue(worker, 1)
async function worker (arg) {
await sleep(10)
return arg
}
queue.drain = undefined
queue.push(1)
await queue.drained()
t.pass('drained resolved successfully with undefined drain')
})
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