mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-26 21:58:34 +00:00
fix blocking error during startup when in demo mode
This commit is contained in:
parent
af9aa239af
commit
14fbb71c00
5 changed files with 37 additions and 12 deletions
|
@ -35,7 +35,7 @@ type EventBus struct {
|
|||
|
||||
func New() *EventBus {
|
||||
return &EventBus{
|
||||
ch: make(chan eventData, 10),
|
||||
ch: make(chan eventData, 100),
|
||||
subscribers: map[Event][]func(any){
|
||||
EventLabelMutation: {},
|
||||
EventLocationMutation: {},
|
||||
|
|
|
@ -92,9 +92,11 @@ func (svc *UserService) RegisterUser(ctx context.Context, data UserRegistration)
|
|||
if err != nil {
|
||||
return repo.UserOut{}, err
|
||||
}
|
||||
log.Debug().Msg("user created")
|
||||
|
||||
// Create the default labels and locations for the group.
|
||||
if creatingGroup {
|
||||
log.Debug().Msg("creating default labels")
|
||||
for _, label := range defaultLabels() {
|
||||
_, err := svc.repos.Labels.Create(ctx, usr.GroupID, label)
|
||||
if err != nil {
|
||||
|
@ -102,6 +104,7 @@ func (svc *UserService) RegisterUser(ctx context.Context, data UserRegistration)
|
|||
}
|
||||
}
|
||||
|
||||
log.Debug().Msg("creating default locations")
|
||||
for _, location := range defaultLocations() {
|
||||
_, err := svc.repos.Locations.Create(ctx, usr.GroupID, location)
|
||||
if err != nil {
|
||||
|
@ -112,6 +115,7 @@ func (svc *UserService) RegisterUser(ctx context.Context, data UserRegistration)
|
|||
|
||||
// Decrement the invitation token if it was used.
|
||||
if token.ID != uuid.Nil {
|
||||
log.Debug().Msg("decrementing invitation token")
|
||||
err = svc.repos.Groups.InvitationUpdate(ctx, token.ID, token.Uses-1)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to update invitation token")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue