Allow running periodic updates with enabled HTTP API (#916)

* Allow running periodic updates with enabled HTTP API

* Add --http-api-periodic-polls to docs
This commit is contained in:
DasSkelett 2021-04-27 22:18:45 +02:00 committed by GitHub
parent e308521a95
commit 6b155a111a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 12 deletions

View file

@ -13,9 +13,13 @@ var (
)
// New is a factory function creating a new Handler instance
func New(updateFn func()) *Handler {
lock = make(chan bool, 1)
lock <- true
func New(updateFn func(), updateLock chan bool) *Handler {
if updateLock != nil {
lock = updateLock
} else {
lock = make(chan bool, 1)
lock <- true
}
return &Handler{
fn: updateFn,