0.2.71
This commit is contained in:
@@ -228,7 +228,6 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
Log: log,
|
||||
Config: creditsConfig,
|
||||
})
|
||||
go creditsService.Run(ctx)
|
||||
// media_url is on this line rather than the ready line because credits detection is
|
||||
// the only thing that uses it, and because reading it back is the only way an
|
||||
// operator can tell that a scan is taking the short path. Where it equals EmbyURL
|
||||
@@ -247,7 +246,6 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
adminBus := adminevents.New(st, log)
|
||||
dispatcher := integrations.New(st, log, adminBus)
|
||||
adminBus.AddSink(dispatcher)
|
||||
dispatcher.Start(ctx)
|
||||
sched := scheduler.New(st, log, adminBus)
|
||||
|
||||
server := api.New(cfg, api.Deps{
|
||||
@@ -270,6 +268,16 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
Scheduler: sched,
|
||||
Integrations: dispatcher,
|
||||
})
|
||||
if err := server.LoadQuietTime(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
sched.SetPaused(server.ActivityPaused)
|
||||
dispatcher.SetPaused(server.ActivityPaused)
|
||||
dispatcher.Start(ctx)
|
||||
if creditsService != nil {
|
||||
creditsService.SetPaused(server.ActivityPaused)
|
||||
go creditsService.Run(ctx)
|
||||
}
|
||||
|
||||
// Registration is separate from construction so the task list reads as a declaration
|
||||
// of what the gateway does in the background rather than as more wiring in here.
|
||||
@@ -294,6 +302,7 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
return err
|
||||
}
|
||||
go server.WatchMaintenance(ctx, 30*time.Second)
|
||||
go server.WatchQuietTime(ctx, 30*time.Second)
|
||||
// One probe per gateway, not per TV: the answer is the same for the whole house.
|
||||
go server.WatchEmbyReachability(ctx, cfg.EmbyHealthInterval)
|
||||
// One Sonarr catalogue reading per day records lifecycle changes for the household and
|
||||
@@ -305,9 +314,12 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
}
|
||||
go server.WatchUpdatePolicy(ctx, 60*time.Second)
|
||||
|
||||
go syncer.Schedule(ctx, cfg.SyncInterval)
|
||||
go syncer.Schedule(ctx, cfg.SyncInterval, server.ActivityPaused)
|
||||
if cfg.SyncOnStart {
|
||||
go func() {
|
||||
if server.ActivityPaused() {
|
||||
return
|
||||
}
|
||||
if _, err := syncer.Sync(ctx, "incremental", "startup"); err != nil {
|
||||
log.Warn("startup sync failed", "error", err)
|
||||
}
|
||||
@@ -319,8 +331,12 @@ func run(log *slog.Logger, events *logging.Buffer) error {
|
||||
cfg.TracearrSyncInterval,
|
||||
cfg.TracearrFullInterval,
|
||||
cfg.ForYouRebuildHour,
|
||||
server.ActivityPaused,
|
||||
)
|
||||
go func() {
|
||||
if server.ActivityPaused() {
|
||||
return
|
||||
}
|
||||
importCtx, cancel := context.WithTimeout(ctx, cfg.SyncTimeout)
|
||||
// Only if one is actually owed. An unconditional startup import made every
|
||||
// redeploy or container bounce a fresh pass over Tracearr's history.
|
||||
|
||||
Reference in New Issue
Block a user