fix registry usage
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
957d7fc6bc
commit
a032ed3e18
|
|
@ -4,6 +4,7 @@ const https = require("https");
|
||||||
const { axios_request, stringify } = require("../../../utils/general");
|
const { axios_request, stringify } = require("../../../utils/general");
|
||||||
const Mutex = require("async-mutex").Mutex;
|
const Mutex = require("async-mutex").Mutex;
|
||||||
const { GrpcError, grpc } = require("../../../utils/grpc");
|
const { GrpcError, grpc } = require("../../../utils/grpc");
|
||||||
|
const { Registry } = require("../../../utils/registry");
|
||||||
|
|
||||||
const USER_AGENT = "democratic-csi";
|
const USER_AGENT = "democratic-csi";
|
||||||
const __REGISTRY_NS__ = "SynologyHttpClient";
|
const __REGISTRY_NS__ = "SynologyHttpClient";
|
||||||
|
|
@ -84,6 +85,7 @@ class SynologyHttpClient {
|
||||||
this.logger = console;
|
this.logger = console;
|
||||||
this.doLoginMutex = new Mutex();
|
this.doLoginMutex = new Mutex();
|
||||||
this.apiSerializeMutex = new Mutex();
|
this.apiSerializeMutex = new Mutex();
|
||||||
|
this.registry = new Registry();
|
||||||
|
|
||||||
if (false) {
|
if (false) {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
|
@ -94,7 +96,7 @@ class SynologyHttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
getHttpAgent() {
|
getHttpAgent() {
|
||||||
return this.ctx.registry.get(`${__REGISTRY_NS__}:http_agent`, () => {
|
return this.registry.get(`${__REGISTRY_NS__}:http_agent`, () => {
|
||||||
return new http.Agent({
|
return new http.Agent({
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
maxSockets: Infinity,
|
maxSockets: Infinity,
|
||||||
|
|
@ -104,7 +106,7 @@ class SynologyHttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
getHttpsAgent() {
|
getHttpsAgent() {
|
||||||
return this.ctx.registry.get(`${__REGISTRY_NS__}:https_agent`, () => {
|
return this.registry.get(`${__REGISTRY_NS__}:https_agent`, () => {
|
||||||
return new https.Agent({
|
return new https.Agent({
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
maxSockets: Infinity,
|
maxSockets: Infinity,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue