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: sqlhealth.go
    path of file: ./repos/go-cloud/server/health/sqlhealth
    
    the code of the file until where you have to start completion: // Copyright 2018 The Go Cloud Development Kit Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o
    
func New(db *sql.DB) *Checker {
	// We create a context here because we are detaching.
	ctx, cancel := context.WithCancel(context.Background())
	stopped := make(chan struct{})
	c := &Checker{
		cancel:  cancel,
		stopped: stopped,
	}
	go func() {
		var timer *time.Timer
		defer func() {
			if timer != nil {
				timer.Stop()
			}
			close(stopped)
		}()

		wait := 250 * time.Millisecond
		const maxWait = 30 * time.Second
		for {
			if err := db.PingContext(ctx); err == nil {
				c.healthy = true
				return
			}
			if timer == nil {
				timer = time.NewTimer(wait)
			} else {
				// Timer already fired, so resetting does not race.
				timer.Reset(wait)
			}
			select {
			case <-timer.C:
				if wait < maxWait {
					// Back off next ping.
					wait *= 2
					if wait > maxWait {
						wait = maxWait
					}
				}
			case <-ctx.Done():
				return
			}
		}
	}()
	return c
}