repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Type cast
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
Worker.ts
diff --git
a/src/charging-station/Worker.ts
b/src/charging-station/Worker.ts
index 93aade5046b44284ee4604e1b17df0e3a9f5d46d..d91942021184855f282892b4c9467a6beee9b5cc 100644
(file)
--- a/
src/charging-station/Worker.ts
+++ b/
src/charging-station/Worker.ts
@@
-1,38
+1,37
@@
import Configuration from '../utils/Configuration';
import Pool from 'worker-threads-pool';
import { Worker } from 'worker_threads';
import Configuration from '../utils/Configuration';
import Pool from 'worker-threads-pool';
import { Worker } from 'worker_threads';
+import WorkerData from '../types/WorkerData';
export default class Wrk {
export default class Wrk {
- private _worker
Data
;
- private _worker
Script
;
- private _pool;
+ private _worker
Script: string
;
+ private _worker
Data: WorkerData
;
+ private _pool
: Pool
;
private _concurrentWorkers: number;
/**
* Create a new `Wrk`.
*
private _concurrentWorkers: number;
/**
* Create a new `Wrk`.
*
- * @param {
S
tring} workerScript
- * @param {
Object
} workerData
- * @param {
N
umber} numConcurrentWorkers
+ * @param {
s
tring} workerScript
+ * @param {
WorkerData
} workerData
+ * @param {
n
umber} numConcurrentWorkers
*/
*/
- constructor(workerScript
, workerData, numConcurrentWorkers
) {
+ constructor(workerScript
: string, workerData: WorkerData, numConcurrentWorkers: number
) {
this._workerData = workerData;
this._workerScript = workerScript;
this._workerData = workerData;
this._workerScript = workerScript;
- this._numConcurrentWorkers = numConcurrentWorkers;
if (Configuration.useWorkerPool()) {
if (Configuration.useWorkerPool()) {
+ this._concurrentWorkers = Configuration.getWorkerPoolSize();
this._pool = new Pool({ max: Configuration.getWorkerPoolSize() });
this._pool = new Pool({ max: Configuration.getWorkerPoolSize() });
+ } else {
+ this._concurrentWorkers = numConcurrentWorkers;
}
}
/**
}
}
/**
- * @
param {Number} numConcurrentWorkers
- * @p
rivate
+ * @
return {number}
+ * @p
ublic
*/
*/
- set _numConcurrentWorkers(numConcurrentWorkers: number) {
- this._concurrentWorkers = numConcurrentWorkers;
- }
-
- get _numConcurrentWorkers(): number {
+ public get concurrentWorkers(): number {
return this._concurrentWorkers;
}
return this._concurrentWorkers;
}