fix: env.json caching, readiness and unique lockerIDs (#3596)

* fix: readiness check

* disable cache for env.json

* always generate unique lockerID

* fix tests
This commit is contained in:
Livio Amstutz
2022-05-04 17:09:49 +02:00
committed by GitHub
parent 929ed8745a
commit 94e420bb24
11 changed files with 8 additions and 276 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"database/sql"
"fmt"
"os"
"time"
"github.com/zitadel/logging"
@@ -34,11 +33,8 @@ type locker struct {
}
func NewLocker(client *sql.DB, lockTable, projectionName string) Locker {
workerName, err := os.Hostname()
if err != nil || workerName == "" {
workerName, err = id.SonyFlakeGenerator.Next()
logging.OnError(err).Panic("unable to generate lockID")
}
workerName, err := id.SonyFlakeGenerator.Next()
logging.OnError(err).Panic("unable to generate lockID")
return &locker{
client: client,
lockStmt: fmt.Sprintf(lockStmtFormat, lockTable),

View File

@@ -2,7 +2,6 @@ package spooler
import (
"math/rand"
"os"
"github.com/zitadel/logging"
@@ -19,11 +18,8 @@ type Config struct {
}
func (c *Config) New() *Spooler {
lockID, err := os.Hostname()
if err != nil || lockID == "" {
lockID, err = id.SonyFlakeGenerator.Next()
logging.OnError(err).Panic("unable to generate lockID")
}
lockID, err := id.SonyFlakeGenerator.Next()
logging.OnError(err).Panic("unable to generate lockID")
//shuffle the handlers for better balance when running multiple pods
rand.Shuffle(len(c.ViewHandlers), func(i, j int) {