Maint: make all set status context aware

This commit is contained in:
Quentin McGaw (desktop)
2021-07-16 00:49:59 +00:00
parent 6bbb7c8f7d
commit 0ed738cd61
16 changed files with 146 additions and 57 deletions

View File

@@ -15,10 +15,12 @@ import (
type Looper interface {
Run(ctx context.Context, done chan<- struct{})
SetStatus(status models.LoopStatus) (outcome string, err error)
SetStatus(ctx context.Context, status models.LoopStatus) (
outcome string, err error)
GetStatus() (status models.LoopStatus)
GetSettings() (settings configuration.HTTPProxy)
SetSettings(settings configuration.HTTPProxy) (outcome string)
SetSettings(ctx context.Context, settings configuration.HTTPProxy) (
outcome string)
}
type looper struct {
@@ -57,7 +59,7 @@ func (l *looper) Run(ctx context.Context, done chan<- struct{}) {
if l.GetSettings().Enabled {
go func() {
_, _ = l.SetStatus(constants.Running)
_, _ = l.SetStatus(ctx, constants.Running)
}()
}