Adding Environment
This commit is contained in:
parent
7c4e00d6fa
commit
2c3a6ddb36
@ -249,8 +249,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Adding instance generator for \"" +
|
||||
identifier +
|
||||
"\" to external Generators. Other Elements can now create instances of this type."
|
||||
identifier +
|
||||
"\" to external Generators. Other Elements can now create instances of this type."
|
||||
);
|
||||
}
|
||||
|
||||
@ -350,8 +350,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Removing instance generator for \"" +
|
||||
identifier +
|
||||
"\" from external Generators. Other Elements cant create instances of this type anymore."
|
||||
identifier +
|
||||
"\" from external Generators. Other Elements cant create instances of this type anymore."
|
||||
);
|
||||
}
|
||||
|
||||
@ -370,8 +370,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Adding instance generator for \"" +
|
||||
identifier +
|
||||
"\" as internal Generator. This Generator wont be used externally."
|
||||
identifier +
|
||||
"\" as internal Generator. This Generator wont be used externally."
|
||||
);
|
||||
}
|
||||
|
||||
@ -382,8 +382,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Rmoving instance generator for \"" +
|
||||
identifier +
|
||||
"\" from internal Generator. The sytem cant create elements of this type any more."
|
||||
identifier +
|
||||
"\" from internal Generator. The sytem cant create elements of this type any more."
|
||||
);
|
||||
}
|
||||
|
||||
@ -436,10 +436,10 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Requesting an Instance of type: \"" +
|
||||
_defDescription.type +
|
||||
"\" with the identifier: \"" +
|
||||
_defDescription.identifier +
|
||||
"\""
|
||||
_defDescription.type +
|
||||
"\" with the identifier: \"" +
|
||||
_defDescription.identifier +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
|
||||
@ -447,8 +447,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"Already created instance with the identifiert: \"" +
|
||||
_defDescription.identifier +
|
||||
"\" => returning this instance"
|
||||
_defDescription.identifier +
|
||||
"\" => returning this instance"
|
||||
);
|
||||
}
|
||||
|
||||
@ -480,8 +480,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
this._logger.debug(
|
||||
"No instance with the identifiert: \"" +
|
||||
_defDescription.identifier +
|
||||
"\" found, but an internal generator is available. Using the internal one for creating the instance and requesting the \"real\" instance externally"
|
||||
_defDescription.identifier +
|
||||
"\" found, but an internal generator is available. Using the internal one for creating the instance and requesting the \"real\" instance externally"
|
||||
);
|
||||
}
|
||||
|
||||
@ -614,12 +614,12 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
// If there is a Logger:
|
||||
this._logger.debug(
|
||||
"Dispatcher \"" +
|
||||
this.id +
|
||||
"\" received request: \"" +
|
||||
data.functionId +
|
||||
"\" -> task: \"" +
|
||||
data.taskId +
|
||||
"\""
|
||||
this.id +
|
||||
"\" received request: \"" +
|
||||
data.functionId +
|
||||
"\" -> task: \"" +
|
||||
data.taskId +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
|
||||
@ -649,29 +649,29 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
// trigger the remote.
|
||||
data.callbacks.map(
|
||||
(options) =>
|
||||
(args[options.idx] = async (..._args) => {
|
||||
// And Create the Task and its Promise.
|
||||
const servicePromise = _this.performCall<any>(
|
||||
options.functionId,
|
||||
_args,
|
||||
options
|
||||
);
|
||||
(args[options.idx] = async (..._args) => {
|
||||
// And Create the Task and its Promise.
|
||||
const servicePromise = _this.performCall<any>(
|
||||
options.functionId,
|
||||
_args,
|
||||
options
|
||||
);
|
||||
|
||||
const cancelCallback = (reason) => {
|
||||
// The Main Task has been canceled =>
|
||||
// We are allowed to canel the Subtask as well.
|
||||
servicePromise.cancel(reason);
|
||||
};
|
||||
cbs.push(cancelCallback);
|
||||
const cancelCallback = (reason) => {
|
||||
// The Main Task has been canceled =>
|
||||
// We are allowed to canel the Subtask as well.
|
||||
servicePromise.cancel(reason);
|
||||
};
|
||||
cbs.push(cancelCallback);
|
||||
|
||||
// Await the Result. If an Task is canceled => The Error is Thrown.
|
||||
const result = await servicePromise;
|
||||
// Await the Result. If an Task is canceled => The Error is Thrown.
|
||||
const result = await servicePromise;
|
||||
|
||||
// Remove the Index
|
||||
cbs.splice(cbs.indexOf(cancelCallback), 1);
|
||||
// Remove the Index
|
||||
cbs.splice(cbs.indexOf(cancelCallback), 1);
|
||||
|
||||
return result;
|
||||
})
|
||||
return result;
|
||||
})
|
||||
);
|
||||
|
||||
// Perform the Task it self.
|
||||
@ -704,10 +704,10 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
// If there is a Logger:
|
||||
this._logger.error(
|
||||
"Dispatcher \"" +
|
||||
this.id +
|
||||
"\" failed with request: \"" +
|
||||
data.taskId +
|
||||
"\""
|
||||
this.id +
|
||||
"\" failed with request: \"" +
|
||||
data.taskId +
|
||||
"\""
|
||||
);
|
||||
this._logger.error(error);
|
||||
}
|
||||
@ -773,7 +773,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -848,7 +848,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
});
|
||||
|
||||
// Subscribe to new available Topics.
|
||||
@ -869,7 +869,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
});
|
||||
|
||||
await this.communicator.onNewInstanceGeneratorsAvailable((data) => {
|
||||
@ -887,7 +887,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
data.dispatcher
|
||||
);
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
});
|
||||
|
||||
await this.communicator.onStatusUpdate((info) => {
|
||||
@ -937,8 +937,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
// If there is a Logger:
|
||||
_this._logger.debug(
|
||||
"Remote Dispatcher \"" +
|
||||
message.dispatcher +
|
||||
"\" updated its available instances"
|
||||
message.dispatcher +
|
||||
"\" updated its available instances"
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -1096,6 +1096,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
const os = require("os");
|
||||
return {
|
||||
id: this.id,
|
||||
env: "javascript",
|
||||
version: "0.9.5",
|
||||
host: {
|
||||
cores: os.cpus().length,
|
||||
cpu: `${os.cpus()[0].model}`,
|
||||
@ -1109,6 +1111,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
};
|
||||
}
|
||||
return {
|
||||
env: "javascript",
|
||||
version: "0.9.5",
|
||||
host: {
|
||||
cores: -1,
|
||||
cpu: "unkown",
|
||||
@ -1382,8 +1386,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
// That should lead to a fatal error ?
|
||||
_this._logger.warn(
|
||||
"An Instance with the name \"" +
|
||||
instance.identifier +
|
||||
"\" has already been declared",
|
||||
instance.identifier +
|
||||
"\" has already been declared",
|
||||
_this._externalInstances.get(instance.identifier)?.type,
|
||||
"!=",
|
||||
instance.type
|
||||
@ -1536,7 +1540,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
protected _subscribeToEvent(event: string) {
|
||||
const item = this._externallySubscribeObservables.get(event) || {
|
||||
observable: this._generateObservable<IExternalEventMsg>(),
|
||||
cb: () => {}
|
||||
cb: () => { }
|
||||
};
|
||||
|
||||
if (!item.observable.hasSubscriptions) {
|
||||
@ -2266,12 +2270,12 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (_this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
_this._logger.debug(
|
||||
"Dispatcher \"" +
|
||||
this.id +
|
||||
"\" requesting externally Function \"" +
|
||||
serviceName +
|
||||
"\" with task: \"" +
|
||||
_taskId +
|
||||
"\""
|
||||
this.id +
|
||||
"\" requesting externally Function \"" +
|
||||
serviceName +
|
||||
"\" with task: \"" +
|
||||
_taskId +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
|
||||
@ -2375,12 +2379,12 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
if (_this._logger?.enabledFor(Logger.DEBUG)) {
|
||||
_this._logger.debug(
|
||||
"Dispatcher \"" +
|
||||
this.id +
|
||||
"\" putting task \"" +
|
||||
_taskId +
|
||||
"\" on: \"" +
|
||||
_this._getServiceName(taskRequest.functionId, "request") +
|
||||
"\""
|
||||
this.id +
|
||||
"\" putting task \"" +
|
||||
_taskId +
|
||||
"\" on: \"" +
|
||||
_this._getServiceName(taskRequest.functionId, "request") +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
|
||||
@ -2391,8 +2395,8 @@ export class nopeDispatcher implements INopeDispatcher {
|
||||
_taskId,
|
||||
new Error(
|
||||
"TIMEOUT. The Service allowed execution time of " +
|
||||
options.timeout.toString() +
|
||||
"[ms] has been excided"
|
||||
options.timeout.toString() +
|
||||
"[ms] has been excided"
|
||||
)
|
||||
);
|
||||
}, options.timeout);
|
||||
|
@ -42,7 +42,9 @@ export type IValidPromise<T> = Promise<T> | INopePromise<T>;
|
||||
export interface IDispatcherInfo {
|
||||
id: string;
|
||||
timestamp: number;
|
||||
status: ENopeDispatcherStatus;
|
||||
status: ENopeDispatcherStatus;
|
||||
env: string,
|
||||
version: string,
|
||||
host: {
|
||||
cores: number;
|
||||
cpu: string;
|
||||
|
Loading…
Reference in New Issue
Block a user