libct: add/use configs.HasHook

This allows to omit a call to c.currentOCIState (which can be somewhat
costly when there are many annotations) when the hooks of a given kind
won't be run.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2024-10-09 11:00:48 -07:00
parent 2e906e292e
commit 8afeb58398
4 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -350,7 +350,7 @@ func (c *Container) start(process *Process) (retErr error) {
if process.Init {
c.fifo.Close()
if c.config.Hooks != nil {
if c.config.HasHook(configs.Poststart) {
s, err := c.currentOCIState()
if err != nil {
return err