Skip to content

Commit bc4f408

Browse files
committed
odp man stopped
1 parent 9abba35 commit bc4f408

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

lib/odp/odp_manager.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,26 @@ export class DefaultOdpManager extends BaseService implements OdpManager {
125125
}
126126

127127
stop(): void {
128-
// if (this.status === Status.Stopped) {
129-
// return;
130-
// }
131-
// this.status = Status.Stopped;
132-
// await this.eventManager.stop();
128+
if (this.isDone()) {
129+
return;
130+
}
131+
132+
if (this.isNew()) {
133+
this.startPromise.reject(new Error('odp manager stopped before starting'));
134+
this.stopPromise.resolve();
135+
return;
136+
}
137+
138+
this.state = ServiceState.Stopping;
139+
this.eventManager.stop();
140+
141+
this.eventManager.onTerminated().then(() => {
142+
this.state = ServiceState.Terminated;
143+
this.stopPromise.resolve();
144+
}).catch((err) => {
145+
this.state = ServiceState.Failed;
146+
this.stopPromise.reject(err);
147+
});
133148
}
134149

135150
updateConfig(odpIntegrationConfig: OdpIntegrationConfig): boolean {

0 commit comments

Comments
 (0)