use global id generator (#142)

* use global id generator

* remove duplicate `UserRemoved`

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2020-05-28 13:28:36 +02:00
committed by GitHub
parent 2758bf30b1
commit e3f9e9c05e
18 changed files with 69 additions and 76 deletions

View File

@@ -3,8 +3,7 @@ package spooler
import (
"github.com/caos/logging"
"github.com/caos/zitadel/internal/eventstore"
"github.com/sony/sonyflake"
"strconv"
"github.com/caos/zitadel/internal/id"
)
type Config struct {
@@ -15,12 +14,12 @@ type Config struct {
}
func (c *Config) New() *Spooler {
lockID, err := sonyflake.NewSonyflake(sonyflake.Settings{}).NextID()
lockID, err := id.SonyFlakeGenerator.Next()
logging.Log("SPOOL-bdO56").OnError(err).Panic("unable to generate lockID")
return &Spooler{
handlers: c.ViewHandlers,
lockID: strconv.FormatUint(lockID, 10),
lockID: lockID,
eventstore: c.Eventstore,
locker: c.Locker,
queue: make(chan *spooledHandler),