repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: factor out measurement statistics requirements default
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
abstract-worker-choice-strategy.ts
diff --git
a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts
b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts
index 476c58bc8bcf45f69450adb196e8886abe6f3b88..37759198c882aae1f47256a7f42e19e9261b92a8 100644
(file)
--- a/
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
+++ b/
src/pools/selection-strategies/abstract-worker-choice-strategy.ts
@@
-1,5
+1,8
@@
import { cpus } from 'node:os'
import { cpus } from 'node:os'
-import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
+import {
+ DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+} from '../../utils'
import type { IPool } from '../pool'
import type { IWorker } from '../worker'
import type {
import type { IPool } from '../pool'
import type { IWorker } from '../worker'
import type {
@@
-13,8
+16,8
@@
import type {
* Worker choice strategy abstract base class.
*
* @typeParam Worker - Type of worker which manages the strategy.
* Worker choice strategy abstract base class.
*
* @typeParam Worker - Type of worker which manages the strategy.
- * @typeParam Data - Type of data sent to the worker. This can only be s
erializ
able data.
- * @typeParam Response - Type of execution response. This can only be s
erializ
able data.
+ * @typeParam Data - Type of data sent to the worker. This can only be s
tructured-clone
able data.
+ * @typeParam Response - Type of execution response. This can only be s
tructured-clone
able data.
*/
export abstract class AbstractWorkerChoiceStrategy<
Worker extends IWorker,
*/
export abstract class AbstractWorkerChoiceStrategy<
Worker extends IWorker,
@@
-38,21
+41,9
@@
export abstract class AbstractWorkerChoiceStrategy<
/** @inheritDoc */
public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
/** @inheritDoc */
public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
- runTime: {
- aggregate: false,
- average: false,
- median: false
- },
- waitTime: {
- aggregate: false,
- average: false,
- median: false
- },
- elu: {
- aggregate: false,
- average: false,
- median: false
- }
+ runTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ waitTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS
}
/**
}
/**
@@
-133,9
+124,8
@@
export abstract class AbstractWorkerChoiceStrategy<
/** @inheritDoc */
public setOptions (opts: WorkerChoiceStrategyOptions): void {
/** @inheritDoc */
public setOptions (opts: WorkerChoiceStrategyOptions): void {
- opts = opts ?? DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
- this.setTaskStatisticsRequirements(opts)
- this.opts = opts
+ this.opts = opts ?? DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+ this.setTaskStatisticsRequirements(this.opts)
}
// /**
}
// /**