func (c *ContainerdUtil) connect() error {
	var err error
	if c.cl != nil {
		err = c.cl.Reconnect()
		if err != nil {
			log.Errorf("Could not reconnect to the containerd daemon: %v", err)
			return c.cl.Close() // Attempt to close connections to avoid overloading the GRPC
		}
		return nil
	}

	c.cl, err = containerd.New(c.socketPath, containerd.WithTimeout(c.connectionTimeout))
	if err != nil {
		return err
	}
	ver, err := c.Metadata()
	if err == nil {
		log.Infof("Connected to containerd - Version %s/%s", ver.Version, ver.Revision)
	}
	return err
}
// connect is our retry strategy, it can be re-triggered when the check is running if we lose connectivity.
connect is our retry strategy, it can be re-triggered when the check is running if we lose connectivity.
// connect is our retry strategy it can be re - triggered when the check is running if we lose connectivity .
func (c *ContainerdUtil) connect() error {
	var err error
	if c.cl != nil {
		err = c.cl.Reconnect()
		if err != nil {
			log.Errorf("Could not reconnect to the containerd daemon: %v", err)
			return c.cl.Close() 
		}
		return nil
	}
	c.cl, err = containerd.New(c.socketPath, containerd.WithTimeout(c.connectionTimeout))
	if err != nil {
		return err
	}
	ver, err := c.Metadata()
	if err == nil {
		log.Infof("Connected to containerd - Version %s/%s", ver.Version, ver.Revision)
	}
	return err
}
func ( c * ContainerdUtil ) connect ( ) error { var err error if c . cl != nil { err = c . cl . Reconnect ( ) if err != nil { log . Errorf ( " " , err ) return c . cl . Close ( ) } return nil } c . cl , err = containerd . New ( c . socketPath , containerd . WithTimeout ( c . connectionTimeout ) ) if err != nil { return err } ver , err := c . Metadata ( ) if err == nil { log . Infof ( " " , ver . Version , ver . Revision ) } return err }
connect is our retry strategy, it can be re-triggered when the check is running if we lose connectivity.
connect is our retry strategy it can be re - triggered when the check is running if we lose connectivity .
// Attempt to close connections to avoid overloading the GRPC