Skip to content

Commit

Permalink
Fix license check when DB conn is flapping (#547)
Browse files Browse the repository at this point in the history
This have slipped unnoticed. 

If only one out of few license check calls fails (e.g. db being
temporarily unavailable), `returnedErr` was not reset and shadowed the
passing check.

This PR updates this logic - a single passed check resets `returnedErr`
and immediately returns, additionally cancelling further (unnecessary)
executions.
  • Loading branch information
mieciu authored Jul 18, 2024
1 parent 6cf3fc0 commit 8f76d82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions quesma/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ func (lm *LogManager) CheckIfConnectedPaidService(service PaidServiceName) (retu
}
if isConnectedToPaidService {
return fmt.Errorf("detected %s-specific table engine, which is not allowed", service)
} else if err == nil { // no paid service detected, no conn errors
returnedErr = nil
break
}
if time.Since(start) > totalCheckTime {
break
Expand Down

0 comments on commit 8f76d82

Please sign in to comment.