Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ import {Server} from "../../server"
import {ConfDTO} from "../lib/dto/ConfDTO"
import {ProgramOptions} from "../lib/common-libs/programOptions"
import {ConfDAL} from "../lib/dal/fileDALs/ConfDAL"
import {ReadableDuniterService, Stack, TransformableDuniterService} from "../../index"
import {DuniterService, ReadableDuniterService, Stack, TransformableDuniterService} from "../../index"
export interface DuniterModule {
name: string
......@@ -29,7 +29,7 @@ export interface DuniterDependency {
input?: (server: Server, conf: ConfDTO, logger:any) => ReadableDuniterService
process?: (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 {
input: ReadableDuniterService[]
process: TransformableDuniterService[]
output: TransformableDuniterService[]
neutral: TransformableDuniterService[]
neutral: DuniterService[]
} = {
input: [],
process: [],
......@@ -442,13 +442,13 @@ export class Stack {
// Start services and streaming between them
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()))
},
// Stop services and streaming between them
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
await Promise.all(modules.map((module:DuniterService) => module.stopService()))
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment