fix: changed dispatcher lifecycle interfaces
This commit is contained in:
1 parent
cb1ed91e05
commit
5f03d4d832
2 files changed
+57
-32
No files matched your search
@@ -39,6 +39,7 @@ type UpdateHandler interface {
|
||||
|
||||
type Poller interface {
|
||||
Start(ctx context.Context) (<-chan model.Update, error)
|
||||
Stop(ctx context.Context) error
|
||||
}
|
||||
|
||||
type DispatcherOption interface {
|
||||
@@ -109,6 +110,10 @@ func (d *Dispatcher) Start(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Dispatcher) Stop(ctx context.Context) error {
|
||||
return d.poller.Stop(ctx)
|
||||
}
|
||||
|
||||
func (d *Dispatcher) handleUpdates(ch <-chan model.Update) {
|
||||
for upd := range ch {
|
||||
d.wg.Go(func() {
|
||||
|
||||
Reference in new issue
Block a user