You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cri.go
    path of file: ./repos/k3s/pkg/agent/cri
    
    the code of the file until where you have to start completion: package cri

import (
	"context"
	"time"

	"github.com/sirupsen/logrus"
)

const maxMsgSize = 1024 * 1024 * 16

// WaitForService blocks in a retry loop until the CRI service
// is functional at the prov
    
func WaitForService(ctx context.Context, address string, service string) error {
	first := true
	for {
		conn, err := Connection(ctx, address)
		if err == nil {
			conn.Close()
			break
		}
		if first {
			first = false
		} else {
			logrus.Infof("Waiting for %s startup: %v", service, err)
		}
		select {
		case <-ctx.Done():
			return ctx.Err()
		case <-time.After(time.Second):
		}
	}
	logrus.Infof("%s is now running", service)
	return nil
}