Commit 4cd799e7 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] Duniter module: "neutral" service is just a DuniterService

parent 0066df94
...@@ -2,7 +2,7 @@ import {Server} from "../../server" ...@@ -2,7 +2,7 @@ import {Server} from "../../server"
import {ConfDTO} from "../lib/dto/ConfDTO" import {ConfDTO} from "../lib/dto/ConfDTO"
import {ProgramOptions} from "../lib/common-libs/programOptions" import {ProgramOptions} from "../lib/common-libs/programOptions"
import {ConfDAL} from "../lib/dal/fileDALs/ConfDAL" import {ConfDAL} from "../lib/dal/fileDALs/ConfDAL"
import {ReadableDuniterService, Stack, TransformableDuniterService} from "../../index" import {DuniterService, ReadableDuniterService, Stack, TransformableDuniterService} from "../../index"
export interface DuniterModule { export interface DuniterModule {
name: string name: string
...@@ -29,7 +29,7 @@ export interface DuniterDependency { ...@@ -29,7 +29,7 @@ export interface DuniterDependency {
input?: (server: Server, conf: ConfDTO, logger:any) => ReadableDuniterService input?: (server: Server, conf: ConfDTO, logger:any) => ReadableDuniterService
process?: (server: Server, conf: ConfDTO, logger:any) => TransformableDuniterService process?: (server: Server, conf: ConfDTO, logger:any) => TransformableDuniterService
output?: (server: Server, conf: ConfDTO, logger:any) => TransformableDuniterService output?: (server: Server, conf: ConfDTO, logger:any) => TransformableDuniterService
neutral?: (server: Server, conf: ConfDTO, logger:any) => TransformableDuniterService neutral?: (server: Server, conf: ConfDTO, logger:any) => DuniterService
} }
} }
......
...@@ -199,7 +199,7 @@ export class Stack { ...@@ -199,7 +199,7 @@ export class Stack {
input: ReadableDuniterService[] input: ReadableDuniterService[]
process: TransformableDuniterService[] process: TransformableDuniterService[]
output: TransformableDuniterService[] output: TransformableDuniterService[]
neutral: TransformableDuniterService[] neutral: DuniterService[]
} = { } = {
input: [], input: [],
process: [], process: [],
...@@ -442,13 +442,13 @@ export class Stack { ...@@ -442,13 +442,13 @@ export class Stack {
// Start services and streaming between them // Start services and streaming between them
async () => { async () => {
const modules = this.streams.input.concat(this.streams.process).concat(this.streams.output).concat(this.streams.neutral); const modules: DuniterService[] = this.streams.neutral.concat(this.streams.input).concat(this.streams.process).concat(this.streams.output);
await Promise.all(modules.map((module:DuniterService) => module.startService())) await Promise.all(modules.map((module:DuniterService) => module.startService()))
}, },
// Stop services and streaming between them // Stop services and streaming between them
async () => { async () => {
const modules = this.streams.input.concat(this.streams.process).concat(this.streams.output).concat(this.streams.neutral); const modules: DuniterService[] = this.streams.neutral.concat(this.streams.input).concat(this.streams.process).concat(this.streams.output);
// Any streaming module must implement a `stopService` method // Any streaming module must implement a `stopService` method
await Promise.all(modules.map((module:DuniterService) => module.stopService())) await Promise.all(modules.map((module:DuniterService) => module.stopService()))
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment