Skip to content

Commit

Permalink
fix: memory leak issue in invoice sync (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbh committed Aug 27, 2024
1 parent b101b8a commit 4eb8455
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion billing/invoice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ func (s *Service) Init(ctx context.Context) error {
s.syncJob.Stop()
}

s.syncJob = cron.New()
s.syncJob = cron.New(cron.WithChain(
cron.SkipIfStillRunning(cron.DefaultLogger),
cron.Recover(cron.DefaultLogger),
))

if _, err := s.syncJob.AddFunc(fmt.Sprintf("@every %s", s.syncDelay.String()), func() {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down

0 comments on commit 4eb8455

Please sign in to comment.