Use post commit hook for post-create plugin hooks (#2920)

This commit is contained in:
WithoutPants
2022-09-19 14:53:06 +10:00
committed by GitHub
parent 0359ce2ed8
commit 2564351265
12 changed files with 109 additions and 88 deletions

View File

@@ -17,7 +17,6 @@ type key int
const (
txnKey key = iota + 1
dbKey
hookManagerKey
)
func (db *Database) WithDatabase(ctx context.Context) (context.Context, error) {
@@ -42,9 +41,6 @@ func (db *Database) Begin(ctx context.Context) (context.Context, error) {
return nil, fmt.Errorf("beginning transaction: %w", err)
}
hookMgr := &hookManager{}
ctx = hookMgr.register(ctx)
return context.WithValue(ctx, txnKey, tx), nil
}
@@ -58,9 +54,6 @@ func (db *Database) Commit(ctx context.Context) error {
return err
}
// execute post-commit hooks
db.executePostCommitHooks(ctx)
return nil
}
@@ -74,9 +67,6 @@ func (db *Database) Rollback(ctx context.Context) error {
return err
}
// execute post-rollback hooks
db.executePostRollbackHooks(ctx)
return nil
}