Skip to content

Commit

Permalink
master reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
kazhuravlev committed Jun 24, 2024
1 parent 1328e21 commit bd9069e
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions private.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@ func (s *Healthcheck) runCheck(ctx context.Context, check checkContainer) Check
ctx, cancel := context.WithTimeout(ctx, check.Check.timeout())
defer cancel()

resCh := make(chan logr.Rec, 1)
go func() {
defer close(resCh)
resCh <- check.Check.check(ctx)
}()

rec := logr.Rec{
Time: time.Now(),
Error: nil,
}

select {
case <-ctx.Done():
rec = logr.Rec{
Time: time.Now(),
Error: ctx.Err(),
{
resCh := make(chan logr.Rec, 1)
go func() {
defer close(resCh)
resCh <- check.Check.check(ctx)
}()

select {
case <-ctx.Done():
rec = logr.Rec{
Time: time.Now(),
Error: ctx.Err(),
}
case rec = <-resCh:
}
case rec = <-resCh:
}

status := StatusUp
Expand Down

0 comments on commit bd9069e

Please sign in to comment.