Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! Generic listener management
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Hewlett committed Sep 25, 2023
1 parent 7b4af02 commit a59b13a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions startup/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ func WithListener(h Listener) ListenersOption {
}
}

func WithListeners(h []Listener) ListenersOption {
return func(l *Listeners) {
l.listeners = append(l.listeners, h...)
}
}

func NewListeners(log Logger, name string, opts ...ListenersOption) Listeners {
l := Listeners{log: log, name: name}
for _, opt := range opts {
Expand All @@ -53,6 +47,10 @@ func (l *Listeners) String() string {
return l.name
}

func (l *Listeners) AddListener(h Listener) {
l.listeners = append(l.listeners, h)
}

func (l *Listeners) Listen() error {

ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
Expand Down

0 comments on commit a59b13a

Please sign in to comment.