Skip to content

Commit

Permalink
fix: replay logs when importing account
Browse files Browse the repository at this point in the history
Signed-off-by: clegirar <clemntgirard@gmail.com>
  • Loading branch information
clegirar committed Jul 6, 2021
1 parent 36304f2 commit 61b5cba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go/pkg/bertymessenger/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type dbWrapper struct {
inTx bool
}

func noopReplayer(_ *dbWrapper) error { return nil }

func (d *dbWrapper) logStep(text string, muts ...tyber.StepMutator) {
tyber.LogStep(d.ctx, d.log, text, muts...)
}
Expand Down
2 changes: 0 additions & 2 deletions go/pkg/bertymessenger/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"berty.tech/berty/v2/go/pkg/protocoltypes"
)

func noopReplayer(_ *dbWrapper) error { return nil }

type getInMemoryTestDBOpts int32

const (
Expand Down
4 changes: 2 additions & 2 deletions go/pkg/bertymessenger/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ func New(client protocoltypes.ProtocolServiceClient, opts *Opts) (_ Service, err
return nil, errcode.ErrDBWrite.Wrap(fmt.Errorf("unable to drop database schema: %w", err))
}

if err := db.db.AutoMigrate(getDBModels()...); err != nil {
return nil, errcode.ErrDBWrite.Wrap(fmt.Errorf("unable to create database schema: %w", err))
if err := db.getUpdatedDB(getDBModels(), noopReplayer, l); err != nil {
return nil, err
}

if err := replayLogsToDB(ctx, client, db); err != nil {
Expand Down

0 comments on commit 61b5cba

Please sign in to comment.