mirror of
https://github.com/go-micro/go-micro.git
synced 2025-03-03 15:22:30 +02:00
33 lines
457 B
Go
33 lines
457 B
Go
package url
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"go-micro.dev/v4/config/source"
|
|
)
|
|
|
|
type urlWatcher struct {
|
|
u *urlSource
|
|
exit chan bool
|
|
}
|
|
|
|
func newWatcher(u *urlSource) (*urlWatcher, error) {
|
|
return &urlWatcher{
|
|
u: u,
|
|
exit: make(chan bool),
|
|
}, nil
|
|
}
|
|
|
|
func (u *urlWatcher) Next() (*source.ChangeSet, error) {
|
|
<-u.exit
|
|
return nil, errors.New("url watcher stopped")
|
|
}
|
|
|
|
func (u *urlWatcher) Stop() error {
|
|
select {
|
|
case <-u.exit:
|
|
default:
|
|
}
|
|
return nil
|
|
}
|