Skip to content

Commit

Permalink
Call Finish in SourceManager after the semaphore is released (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcastorina authored Nov 24, 2023
1 parent 024aa05 commit 78219a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sources/source_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func (s *SourceManager) asyncRun(ctx context.Context, sourceName string, source
}
s.wg.Add(1)
go func() {
// Call Finish after the semaphore has been released.
defer progress.Finish()
defer s.sem.Release(1)
defer s.wg.Done()
ctx := context.WithValues(ctx,
Expand Down Expand Up @@ -216,7 +218,6 @@ func (s *SourceManager) preflightChecks(ctx context.Context) error {
// acquired resources. An error is returned if there was a fatal error during
// the run. This information is also recorded in the JobProgress.
func (s *SourceManager) run(ctx context.Context, source Source, report *JobProgress) error {
defer report.Finish()
report.Start(time.Now())
defer func() { report.End(time.Now()) }()

Expand Down

0 comments on commit 78219a2

Please sign in to comment.