mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 03:00:42 +00:00
feat: power-cycle
This commit is contained in:
parent
0e5e989192
commit
d0f0530ca2
7 changed files with 242 additions and 18 deletions
16
main.go
16
main.go
|
|
@ -10,6 +10,7 @@ import (
|
|||
"os/signal"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
|
|
@ -100,6 +101,21 @@ func main() {
|
|||
}
|
||||
return nil
|
||||
})
|
||||
group.Go(func() error {
|
||||
ticker := time.NewTicker(cfg.ReconcileInterval)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-groupCtx.Done():
|
||||
return nil
|
||||
case <-ticker.C:
|
||||
if err := hostDaemon.Reconcile(groupCtx); err != nil && groupCtx.Err() == nil {
|
||||
fmt.Fprintf(os.Stderr, "warning: firecracker-host reconcile failed: %v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if err := group.Wait(); err != nil {
|
||||
exit(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue