mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 01:08:47 +02:00
fix(idlewatcher): correctly restart on config reload
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/yusing/godoxy/internal/common"
|
||||
config "github.com/yusing/godoxy/internal/config/types"
|
||||
"github.com/yusing/godoxy/internal/notif"
|
||||
"github.com/yusing/godoxy/internal/watcher"
|
||||
"github.com/yusing/godoxy/internal/watcher/events"
|
||||
@@ -70,7 +71,7 @@ func Reload() gperr.Error {
|
||||
|
||||
// cancel all current subtasks -> wait
|
||||
// -> replace config -> start new subtasks
|
||||
GetState().Task().FinishAndWait("config changed")
|
||||
GetState().Task().FinishAndWait(config.ErrConfigChanged)
|
||||
SetState(newState)
|
||||
|
||||
if err := newState.StartProviders(); err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"iter"
|
||||
"net/http"
|
||||
|
||||
@@ -33,3 +34,5 @@ type State interface {
|
||||
|
||||
// could be nil
|
||||
var ActiveState synk.Value[State]
|
||||
|
||||
var ErrConfigChanged = errors.New("config changed")
|
||||
|
||||
Reference in New Issue
Block a user