Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit b29303c

Browse files
authored
Nicer license checker error message (#1437)
The error message `License checker failed to connect with the database` is very confusing. It was interpreted during a talk with our user as a licensing problem. This PR: 1. Creates backoff up to a minute, so we don't flood the logs. 2. Reword it too `Failed to connect with the database, can't determine if license is required`. 3. Show underling error.
1 parent 9b01843 commit b29303c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

platform/clickhouse/clickhouse.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,24 @@ func (lm *LogManager) CheckIfConnectedPaidService(service PaidServiceName) (retu
270270
if _, ok := paidServiceChecks[service]; !ok {
271271
return fmt.Errorf("service %s is not supported", service)
272272
}
273+
backOffTime := 3 * time.Second
273274
for {
274275
isConnectedToPaidService, err := lm.isConnectedToPaidService(service)
275276
if err != nil {
276-
logger.Error().Msgf("Licensing checker failed to connect with the database")
277+
logger.ErrorWithCtx(lm.ctx).Msgf(
278+
"Failed to connect with the database, can't determine if license is required: %v", err)
277279
}
278280
if isConnectedToPaidService {
279281
return fmt.Errorf("detected %s-specific table engine, which is not allowed", service)
280282
} else if err == nil { // no paid service detected, no conn errors
281283
returnedErr = nil
282284
break
283285
}
284-
time.Sleep(3 * time.Second)
286+
time.Sleep(backOffTime)
287+
backOffTime *= 2 // exponential backoff
288+
if backOffTime > time.Minute {
289+
backOffTime = time.Minute
290+
}
285291
}
286292
return returnedErr
287293
}

0 commit comments

Comments
 (0)