code: func emailOnTimeout(fnName string, d time.Duration, fn func() error) error {
  	c := make(chan error, 1)
  	go func() {
  		c <- fn()
  	}()
  	select {
  	case <-time.After(d):
  		log.Printf("timeout for %s, sending e-mail about it", fnName)
  		m := mailGun.NewMessage(
  			"noreply@perkeep.org",
  			"timeout for docker on pk-web",
  			"Because "+fnName+" is stuck.",
  			"mathieu.lonjaret@gmail.com",
  		)
  		if _, _, err := mailGun.Send(m); err != nil {
  			return fmt.Errorf("failed to send docker restart e-mail: %v", err)
  		}
  		return nil
  	case err := <-c:
  		return err
  	}
  }
docs: // emailOnTimeout runs fn in a goroutine. If fn is not done after d,
  // a message about fnName is logged, and an e-mail about it is sent.