Skip to content

Commit

Permalink
init the storage before relay, so that it may be used within the rela…
Browse files Browse the repository at this point in the history
…y's init function
  • Loading branch information
LiranCohen authored and fiatjaf committed Nov 8, 2023
1 parent 5b4e4d2 commit f5a2ca4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions start.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ func NewServer(relay Relay, opts ...Option) (*Server, error) {
options: options,
}

if err := relay.Storage(context.Background()).Init(); err != nil {
return nil, fmt.Errorf("storage init: %w", err)
}

// init the relay
if err := relay.Init(); err != nil {
return nil, fmt.Errorf("relay init: %w", err)
}
if err := relay.Storage(context.Background()).Init(); err != nil {
return nil, fmt.Errorf("storage init: %w", err)
}

// start listening from events from other sources, if any
if inj, ok := relay.(Injector); ok {
Expand Down

0 comments on commit f5a2ca4

Please sign in to comment.