refactor blueprint with worker (#533)

Closes #495
This commit is contained in:
Victor Vrantchan
2018-10-14 00:02:05 -04:00
committed by GitHub
parent 18fc598035
commit 276e5756af
11 changed files with 274 additions and 182 deletions

View File

@@ -159,14 +159,20 @@ func serve(args []string) error {
userWorker := user.NewWorker(userDB, sm.PubClient, logger)
go userWorker.Run(context.Background())
bpDB, err := blueprintbuiltin.NewDB(sm.DB, sm.ProfileDB, userDB)
bpDB, err := blueprintbuiltin.NewDB(sm.DB, sm.ProfileDB)
if err != nil {
stdlog.Fatal(err)
}
if err := bpDB.StartListener(sm.PubClient, sm.CommandService); err != nil {
stdlog.Fatal(err)
}
blueprintWorker := blueprint.NewWorker(
bpDB,
userDB,
sm.ProfileDB,
sm.CommandService,
sm.PubClient,
logger,
)
go blueprintWorker.Run(context.Background())
ctx := context.Background()
httpLogger := log.With(logger, "transport", "http")