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: retry.go
    path of file: ./repos/buildkit/vendor/github.com/tonistiigi/go-actions-cache
    
    the code of the file until where you have to start completion: package actionscache

import (
	"context"
	"sync"
	"time"

	"github.com/pkg/errors"
)

const maxBackoff = time.Second * 90
const minBackoff = time.Second * 1

var defaultBackoffPool = &BackoffPool{}

type BackoffPool struct {
	mu      sync.Mutex
	queue   []chan struct{}
	timer   *time.Timer
	backoff 
    
func (b *BackoffPool) Wait(ctx context.Context, timeout time.Duration) error {
	b.mu.Lock()
	if b.timer == nil {
		b.mu.Unlock()
		return nil
	}

	done := make(chan struct{})
	b.queue = append(b.queue, done)

	b.mu.Unlock()

	select {
	case <-ctx.Done():
		return ctx.Err()
	case <-done:
		return nil
	case <-time.After(timeout):
		return errors.Errorf("maximum timeout reached")
	}
}