func (w *workload) Run(ctx context.Context) error {
	defaultConnInterval := 50 * time.Millisecond
	conns := make([]db.Conn, 0, 1000)
	interval := defaultConnInterval
	timer := time.NewTimer(interval)
	for {
		select {
		case <-timer.C:
			c, err := db.Connect(ctx, w.config.Conninfo)
			if err != nil {
				w.logger.Info(err.Error())
				interval = interval * 2
			} else {
				conns = append(conns, c)
				if interval > defaultConnInterval {
					interval = interval / 2
				}
			}
			timer.Reset(interval)
		case <-ctx.Done():
			w.cleanup(conns)
			return nil
		}
	}
}
Run method connects to Postgres and starts the workload.
package failconns
import (
	"context"
	"github.com/lesovsky/noisia"
	"github.com/lesovsky/noisia/db"
	"github.com/lesovsky/noisia/log"
	"time"
)
type Config struct {
	Conninfo string
}
func (c Config) validate() error {
	return nil
}
type workload struct {
	config Config
	logger log.Logger
}
func NewWorkload(config Config, logger log.Logger) (noisia.Workload, error) {
	err := config.validate()
	if err != nil {
		return nil, err
	}
	return &workload{config, logger}, nil
}