func (f *Factory) NewRegistryAndHandler(metrics WebhookMetrics) (Registry, http.Handler) {
	tick := f.Tick
	if tick == nil {
		tick = time.Tick
	}
	monitor := &monitor{
		list:             NewList(nil),
		undertaker:       f.undertaker,
		changes:          make(chan []W, 10),
		undertakerTicker: tick(f.UndertakerInterval),
	}
	f.m = monitor
	f.m.Notifier = f.Notifier
	f.m.metrics = metrics
	reg := NewRegistry(f.m)
	go monitor.listen()
	return reg, monitor
}
NewRegistryAndHandler returns a List instance for accessing webhooks and an HTTP handler
which can receive updates from external systems.
package webhook
import (
	"net/http"
	"time"
	"github.com/spf13/viper"
	AWS "github.com/xmidt-org/webpa-common/v2/webhook/aws"
	"github.com/xmidt-org/webpa-common/v2/xhttp"
)
const (
	DEFAULT_UNDERTAKER_INTERVAL time.Duration = time.Minute
)
type Factory struct {
	Tick func(time.Duration) <-chan time.Time `json:"-"`
	UndertakerInterval time.Duration `json:"undertakerInterval"`
	undertaker func([]W) []W `json:"-"`
	m *monitor `json:"-"`
	AWS.Notifier `json:"-"`
	Start *StartConfig `json:"start"`
}
func NewFactory(v *viper.Viper) (f *Factory, err error) {
	f = &Factory{
		UndertakerInterval: DEFAULT_UNDERTAKER_INTERVAL,
	}
	if v != nil {
		err = v.Unmarshal(f)
		if err != nil {
			return
		}
	}
	if v != nil {
		f.Start = NewStartFactory(v.Sub("start"))
	} else {
		f.Start = NewStartFactory(nil)
	}
	f.undertaker = f.Prune
	f.Notifier, err = AWS.NewNotifier(v)
	return
}
func (f *Factory) SetList(ul UpdatableList) {
	f.m.list = ul
	f.m.metrics.ListSize.Set(float64(f.m.list.Len()))
}
func (f *Factory) Prune(items []W) (list []W) {
	for i := 0; i < len(items); i++ {
		if items[i].Until.After(time.Now()) {
			list = append(list, items[i])
		}
	}
	return
}