From 8f76d82aa38b9ae06c2b48f1a359c2b1e83000ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Hejman?= Date: Thu, 18 Jul 2024 21:09:29 +0200 Subject: [PATCH] Fix license check when DB conn is flapping (#547) 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. --- quesma/clickhouse/clickhouse.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quesma/clickhouse/clickhouse.go b/quesma/clickhouse/clickhouse.go index 7b4e928f6..52fe25bae 100644 --- a/quesma/clickhouse/clickhouse.go +++ b/quesma/clickhouse/clickhouse.go @@ -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