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

nighthouse

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nighthouse - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

24

out/common/lighthouse.js

@@ -142,5 +142,25 @@ "use strict";

async *receiveStreaming(id) {
while (true) {
yield await this.receiveSingle(id);
// We use a queue of promises instead of naively performing `receiveSingle`
// in a loop to deal with the scenario where the server sends messages
// faster than we clients can process them.
try {
const nextPromises = [];
const pushPromise = () => {
const deferred = new deferred_1.Deferred();
this.responseHandlers.set(id, deferred);
nextPromises.push(deferred.promise.then(message => {
pushPromise();
return message;
}));
};
pushPromise();
while (true) {
const promise = nextPromises.shift();
yield await promise;
}
}
finally {
this.logger.trace(`Deleting stream handler for ${id}`);
this.responseHandlers.delete(id);
}
}

@@ -147,0 +167,0 @@ /** Handles a server message. */

2

package.json
{
"name": "nighthouse",
"version": "2.1.2",
"version": "2.1.3",
"description": "Lightweight Project Lighthouse client for JavaScript",

@@ -5,0 +5,0 @@ "workspaces": [

@@ -165,4 +165,27 @@ import { Transport } from "./transport";

private async* receiveStreaming(id: number): AsyncIterable<ServerMessage<unknown>> {
while (true) {
yield await this.receiveSingle(id);
// We use a queue of promises instead of naively performing `receiveSingle`
// in a loop to deal with the scenario where the server sends messages
// faster than we clients can process them.
try {
const nextPromises = [];
const pushPromise = () => {
const deferred = new Deferred<ServerMessage<unknown>>();
this.responseHandlers.set(id, deferred);
nextPromises.push(deferred.promise.then(message => {
pushPromise();
return message;
}));
}
pushPromise();
while (true) {
const promise = nextPromises.shift();
yield await promise;
}
} finally {
this.logger.trace(`Deleting stream handler for ${id}`);
this.responseHandlers.delete(id);
}

@@ -169,0 +192,0 @@ }

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