Skip to content

Commit

Permalink
fixing the issue with the calling home not repeating (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao authored Jun 10, 2024
1 parent 342d51c commit 17b37e8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func main() {

c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
ctx := basecontext.NewRootBaseContext()
go func() {
<-c
ctx := basecontext.NewRootBaseContext()
sp := serviceprovider.Get()
if sp != nil {
db := sp.JsonDatabase
Expand All @@ -102,9 +102,18 @@ func main() {
}()

go func() {
// Call home every 24 hours
callHome()
time.Sleep(24 * time.Hour)
for {
select {
case <-c:
ctx.LogInfof("[Core] Exiting")
return
default:
// Call home every 24 hours
ctx.LogInfof("[Core] Calling home")
callHome()
time.Sleep(24 * time.Hour)
}
}
}()

cmd.Process()
Expand Down

0 comments on commit 17b37e8

Please sign in to comment.