pull/1508/head
withchao 2 years ago
parent dbeeb6d2b1
commit 73d404d384

@ -21,6 +21,7 @@ func (m *mongoTx) Transaction(ctx context.Context, fn func(ctx context.Context)
if err != nil { if err != nil {
return err return err
} }
defer sess.EndSession(ctx)
_, err = sess.WithTransaction(ctx, func(ctx mongo.SessionContext) (interface{}, error) { _, err = sess.WithTransaction(ctx, func(ctx mongo.SessionContext) (interface{}, error) {
return nil, fn(ctx) return nil, fn(ctx)
}) })

Loading…
Cancel
Save