mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-07 18:15:47 +08:00
decouple device updates from db CRUD (#427)
Move the code for polling topics and updating device records into an independent worker. Cleans up the code and makes it possible to swap the db backend.
This commit is contained in:
@@ -180,11 +180,14 @@ func serve(args []string) error {
|
||||
removeService = block.LoggingMiddleware(logger)(svc)
|
||||
}
|
||||
|
||||
devDB, err := devicebuiltin.NewDB(sm.db, sm.pubclient)
|
||||
devDB, err := devicebuiltin.NewDB(sm.db)
|
||||
if err != nil {
|
||||
stdlog.Fatal(err)
|
||||
}
|
||||
|
||||
devWorker := device.NewWorker(devDB, sm.pubclient, logger)
|
||||
go devWorker.Run(context.Background())
|
||||
|
||||
userDB, err := userbuiltin.NewDB(sm.db, sm.pubclient, log.With(logger, "component", "user db"))
|
||||
if err != nil {
|
||||
stdlog.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user