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

@citymallservices/k8s-grpc-resolver

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@citymallservices/k8s-grpc-resolver - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

28

dist/index.js

@@ -78,4 +78,4 @@ "use strict";

const hostPort = (0, uri_parser_1.splitHostPort)(target.path);
this.serviceName = hostPort.host;
this.port = hostPort.port;
this.serviceName = hostPort === null || hostPort === void 0 ? void 0 : hostPort.host;
this.port = hostPort === null || hostPort === void 0 ? void 0 : hostPort.port;
if (!this.serviceName || !this.port) {

@@ -119,4 +119,4 @@ this.error = {

let changed = false;
for (const sub of obj.subsets) {
for (const point of sub.addresses) {
for (const sub of obj.subsets || []) {
for (const point of sub.addresses || []) {
if (!this.addresses.has(point.ip)) {

@@ -137,4 +137,4 @@ this.addresses.add(point.ip);

let changed = false;
for (const sub of obj.subsets) {
for (const point of sub.addresses) {
for (const sub of obj.subsets || []) {
for (const point of sub.addresses || []) {
if (this.addresses.has(point.ip)) {

@@ -154,3 +154,3 @@ this.addresses.delete(point.ip);

this.resetBackoff();
this.handleFullUpdate(obj.subsets);
this.handleFullUpdate(obj.subsets || []);
this.trace(`informer update event, obj: ${JSON.stringify(obj)}`);

@@ -162,4 +162,6 @@ console.log(`[K8sResolover] informer update event, obj: ${JSON.stringify(obj)}`);

informer.on("error", (err) => {
var _a;
this.listener.onError(this.defaultResolutionError);
var _a, _b, _c, _d;
if (this.defaultResolutionError) {
this.listener.onError(this.defaultResolutionError);
}
if (!this.backoff) {

@@ -171,7 +173,7 @@ this.backoff = backoffFactory.next(null);

}
this.trace(`informer error event, will restart informer, backoff duration: ${this.backoff.duration()}, err: ${JSON.stringify(err)}`);
console.log(`[K8sResolover] informer error event, will restart informer, backoff duration: ${this.backoff.duration()}, err: ${JSON.stringify(err)}`);
this.trace(`informer error event, will restart informer, backoff duration: ${((_b = this.backoff) === null || _b === void 0 ? void 0 : _b.duration()) || 0}, err: ${JSON.stringify(err)}`);
console.log(`[K8sResolover] informer error event, will restart informer, backoff duration: ${((_c = this.backoff) === null || _c === void 0 ? void 0 : _c.duration()) || 0}, err: ${JSON.stringify(err)}`);
setTimeout(() => informer
.start()
.catch((err) => console.error(`[K8sResolover] Error`, err)), this.backoff.duration());
.catch((err) => console.error(`[K8sResolover] Error`, err)), ((_d = this.backoff) === null || _d === void 0 ? void 0 : _d.duration()) || 0);
});

@@ -214,3 +216,3 @@ this.informer = informer;

for (const sub of subsets) {
for (const point of sub.addresses) {
for (const point of sub.addresses || []) {
if (!newAddressesSet.has(point.ip)) {

@@ -217,0 +219,0 @@ newAddressesSet.add(point.ip);

{
"name": "@citymallservices/k8s-grpc-resolver",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -5,0 +5,0 @@ "scripts": {

@@ -55,4 +55,4 @@ import { ChannelOptions, Metadata, StatusObject } from "@grpc/grpc-js";

private namespace: string;
private port: number;
private serviceName: string;
private port: number | undefined;
private serviceName: string | undefined;
private addresses = new Set<string>();

@@ -73,4 +73,4 @@ private informer: k8s.Informer<k8s.V1Endpoints> | undefined;

const hostPort = splitHostPort(target.path);
this.serviceName = hostPort!.host;
this.port = hostPort!.port!;
this.serviceName = hostPort?.host;
this.port = hostPort?.port;

@@ -127,4 +127,4 @@ if (!this.serviceName || !this.port) {

let changed = false;
for (const sub of obj.subsets!) {
for (const point of sub.addresses!) {
for (const sub of obj.subsets || []) {
for (const point of sub.addresses || []) {
if (!this.addresses.has(point.ip)) {

@@ -155,4 +155,4 @@ this.addresses.add(point.ip);

let changed = false;
for (const sub of obj.subsets!) {
for (const point of sub.addresses!) {
for (const sub of obj.subsets || []) {
for (const point of sub.addresses || []) {
if (this.addresses.has(point.ip)) {

@@ -184,3 +184,3 @@ this.addresses.delete(point.ip);

this.handleFullUpdate(obj.subsets!);
this.handleFullUpdate(obj.subsets || []);

@@ -196,3 +196,5 @@ this.trace(`informer update event, obj: ${JSON.stringify(obj)}`);

informer.on("error", (err: any) => {
this.listener.onError(this.defaultResolutionError!);
if (this.defaultResolutionError) {
this.listener.onError(this.defaultResolutionError);
}

@@ -206,11 +208,11 @@ if (!this.backoff) {

this.trace(
`informer error event, will restart informer, backoff duration: ${this.backoff!.duration()}, err: ${JSON.stringify(
err
)}`
`informer error event, will restart informer, backoff duration: ${
this.backoff?.duration() || 0
}, err: ${JSON.stringify(err)}`
);
console.log(
`[K8sResolover] informer error event, will restart informer, backoff duration: ${this.backoff!.duration()}, err: ${JSON.stringify(
err
)}`
`[K8sResolover] informer error event, will restart informer, backoff duration: ${
this.backoff?.duration() || 0
}, err: ${JSON.stringify(err)}`
);

@@ -222,3 +224,3 @@ setTimeout(

.catch((err) => console.error(`[K8sResolover] Error`, err)),
this.backoff!.duration()
this.backoff?.duration() || 0
);

@@ -256,3 +258,3 @@ });

host: addr,
port: this.port,
port: this.port!,
}));

@@ -284,3 +286,3 @@ }

for (const sub of subsets) {
for (const point of sub.addresses!) {
for (const point of sub.addresses || []) {
if (!newAddressesSet.has(point.ip)) {

@@ -287,0 +289,0 @@ newAddressesSet.add(point.ip);

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