mirror of
https://github.com/safing/portmaster
synced 2025-09-04 19:49:15 +00:00
[service] Fix startup race condition
This commit is contained in:
parent
113dc0438a
commit
c6ddaf8e1e
2 changed files with 7 additions and 5 deletions
|
@ -23,7 +23,7 @@ var (
|
||||||
cfgFilterLists []string
|
cfgFilterLists []string
|
||||||
)
|
)
|
||||||
|
|
||||||
func registerConfigUpdater() error {
|
func registerGlobalConfigProfileUpdater() error {
|
||||||
module.instance.Config().EventConfigChange.AddCallback("update global config profile", func(wc *mgr.WorkerCtx, s struct{}) (cancel bool, err error) {
|
module.instance.Config().EventConfigChange.AddCallback("update global config profile", func(wc *mgr.WorkerCtx, s struct{}) (cancel bool, err error) {
|
||||||
return false, updateGlobalConfigProfile(wc.Ctx())
|
return false, updateGlobalConfigProfile(wc.Ctx())
|
||||||
})
|
})
|
||||||
|
|
|
@ -61,10 +61,6 @@ func prep() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := registerConfigUpdater(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := registerMigrations(); err != nil {
|
if err := registerMigrations(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -118,6 +114,12 @@ func start() error {
|
||||||
|
|
||||||
module.mgr.Go("clean active profiles", cleanActiveProfiles)
|
module.mgr.Go("clean active profiles", cleanActiveProfiles)
|
||||||
|
|
||||||
|
// Register config callback when starting, as it depends on the updates module,
|
||||||
|
// but the config system will already submit events earlier.
|
||||||
|
if err := registerGlobalConfigProfileUpdater(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = updateGlobalConfigProfile(module.mgr.Ctx())
|
err = updateGlobalConfigProfile(module.mgr.Ctx())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("profile: error during loading global profile from configuration: %s", err)
|
log.Warningf("profile: error during loading global profile from configuration: %s", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue