Skip to content

Commit

Permalink
fix ordering of txn callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
nasdf committed Jun 10, 2024
1 parent 5ccea09 commit e70d101
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions datastore/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@ func (t *txn) Commit(ctx context.Context) error {
asyncFns = t.successAsyncFns
}

for _, fn := range fns {
fn()
}
for _, fn := range asyncFns {
go fn()
}
for _, fn := range fns {
fn()
}
return err
}

func (t *txn) Discard(ctx context.Context) {
t.t.Discard(ctx)
for _, fn := range t.discardFns {
fn()
}
for _, fn := range t.discardAsyncFns {
go fn()
}
for _, fn := range t.discardFns {
fn()
}
}

func (t *txn) OnSuccess(fn func()) {
Expand Down

0 comments on commit e70d101

Please sign in to comment.