diff options
Diffstat (limited to 'service/app_runner.go')
-rw-r--r-- | service/app_runner.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/service/app_runner.go b/service/app_runner.go index 61942b2..a960e70 100644 --- a/service/app_runner.go +++ b/service/app_runner.go | |||
@@ -7,18 +7,15 @@ import ( | |||
7 | "os/signal" | 7 | "os/signal" |
8 | "sync" | 8 | "sync" |
9 | "syscall" | 9 | "syscall" |
10 | ) | ||
11 | 10 | ||
12 | type AppRunnerLogger interface { | 11 | "code.crute.us/mcrute/golib/log" |
13 | Info(...interface{}) | 12 | ) |
14 | Error(...interface{}) | ||
15 | } | ||
16 | 13 | ||
17 | type SyncRunnerFunc func() error | 14 | type SyncRunnerFunc func() error |
18 | type RunnerFunc func(context.Context, *sync.WaitGroup) error | 15 | type RunnerFunc func(context.Context, *sync.WaitGroup) error |
19 | 16 | ||
20 | type AppRunner struct { | 17 | type AppRunner struct { |
21 | Logger AppRunnerLogger | 18 | Logger log.LeveledLogger |
22 | initJobs []SyncRunnerFunc // Jobs that run synchronously before other jobs | 19 | initJobs []SyncRunnerFunc // Jobs that run synchronously before other jobs |
23 | jobs []RunnerFunc // Normal jobs | 20 | jobs []RunnerFunc // Normal jobs |
24 | backgroundJobs []RunnerFunc // Jobs that can be disabled | 21 | backgroundJobs []RunnerFunc // Jobs that can be disabled |
@@ -29,7 +26,7 @@ type AppRunner struct { | |||
29 | ctxCancel context.CancelFunc | 26 | ctxCancel context.CancelFunc |
30 | } | 27 | } |
31 | 28 | ||
32 | func NewAppRunner(ctx context.Context, logger AppRunnerLogger) *AppRunner { | 29 | func NewAppRunner(ctx context.Context, logger log.LeveledLogger) *AppRunner { |
33 | r := &AppRunner{ | 30 | r := &AppRunner{ |
34 | initJobs: []SyncRunnerFunc{}, | 31 | initJobs: []SyncRunnerFunc{}, |
35 | jobs: []RunnerFunc{}, | 32 | jobs: []RunnerFunc{}, |