File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
packages/background-charm-service/src Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,16 @@ const service = new BackgroundCharmService({
3939 workerTimeoutMs,
4040} ) ;
4141
42- const shutdown = ( ) => {
43- // @ts -ignore: Object is possibly 'undefined'
44- service . stop ( ) . then ( ( ) => {
45- Deno . exit ( 0 ) ;
46- } ) ;
47- } ;
42+ function shutdown ( service : BackgroundCharmService ) {
43+ return ( ) => {
44+ service . stop ( ) . then ( ( ) => {
45+ Deno . exit ( 0 ) ;
46+ } ) ;
47+ } ;
48+ }
4849
49- Deno . addSignalListener ( "SIGINT" , shutdown ) ;
50- Deno . addSignalListener ( "SIGTERM" , shutdown ) ;
50+ Deno . addSignalListener ( "SIGINT" , shutdown ( service ) ) ;
51+ Deno . addSignalListener ( "SIGTERM" , shutdown ( service ) ) ;
5152
5253service . initialize ( ) . then ( ( ) => {
5354 console . log ( "Background Charm Service started successfully" ) ;
Original file line number Diff line number Diff line change @@ -57,11 +57,11 @@ export class BackgroundCharmService {
5757 this . charmsCell . sink ( ( cs ) => this . ensureCharms ( cs ) ) ;
5858 }
5959
60- stop ( ) {
60+ stop ( ) : Promise < PromiseSettledResult < void > [ ] > {
6161 // FIXME(ja): stop listening to the charms cell ?
6262 if ( ! this . isRunning ) {
6363 console . log ( "Service is not running" ) ;
64- return ;
64+ return Promise . resolve ( [ ] ) ;
6565 }
6666
6767 const promises = Array . from ( this . charmSchedulers . values ( ) ) . map (
You can’t perform that action at this time.
0 commit comments