Skip to content

Commit

Permalink
fix: cleanup after shutting down
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-esk committed Nov 30, 2023
1 parent 790253c commit 0f85cdc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ var startCmd = &cobra.Command{
NetworkInterface: iface,
}
go pl.Start(ctx, logger)
defer func() {
// wait for the service to be finished with the cleanup
for pl.Ready() {
time.Sleep(1 * time.Second)
}
}()
}

/*---------*/
Expand All @@ -94,6 +100,12 @@ var startCmd = &cobra.Command{
NetworkInterface: iface,
}
go b.Start(ctx, logger)
defer func() {
// wait for the service to be finished with the cleanup
for b.Ready() {
time.Sleep(1 * time.Second)
}
}()
}

/*---------*/
Expand All @@ -106,6 +118,12 @@ var startCmd = &cobra.Command{
TcBinPath: flagsStart.tcBinPath,
}
go l.Start(ctx, logger)
defer func() {
// wait for the service to be finished with the cleanup
for l.Ready() {
time.Sleep(1 * time.Second)
}
}()
}

/*---------*/
Expand Down

0 comments on commit 0f85cdc

Please sign in to comment.