Skip to content

Commit

Permalink
Enforce pause in hotspot after fallback timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Otterverse committed Dec 4, 2024
1 parent eb2d73f commit 9185928
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/viam-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func main() {
}

// wait until now when we (potentially) have a network logger to record this
globalLogger.Infof("Viam Agent Version: %s\nGit Revision: %s\n", agent.GetVersion(), agent.GetRevision())
globalLogger.Infof("Viam Agent Version: %s Git Revision: %s", agent.GetVersion(), agent.GetRevision())

// if FastStart is set, skip updates and start viam-server immediately, then proceed as normal
var fastSuccess bool
Expand Down
7 changes: 5 additions & 2 deletions subsystems/provisioning/networkmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ func (w *Provisioning) mainLoop(ctx context.Context) {
w.logger.Error(err)
} else {
pMode = w.connState.getProvisioning()
pModeChange = w.connState.getProvisioningChange()
}
}
}
Expand All @@ -736,9 +737,11 @@ func (w *Provisioning) mainLoop(ctx context.Context) {
}
}

hitOfflineTimeout := lastConnectivity.Before(now.Add(time.Duration(w.cfg.OfflineTimeout)*-1)) &&
pModeChange.Before(now.Add(time.Duration(w.cfg.OfflineTimeout)*-1))
// not in provisioning mode, so start it if not configured (/etc/viam.json)
// OR as long as we've been offline for at least OfflineTimeout (2 minute default)
if !isConfigured || lastConnectivity.Before(now.Add(time.Duration(w.cfg.OfflineTimeout)*-1)) {
// OR as long as we've been offline AND out of provisioning mode for at least OfflineTimeout (2 minute default)
if !isConfigured || hitOfflineTimeout {
if err := w.StartProvisioning(ctx, inputChan); err != nil {
w.logger.Error(err)
}
Expand Down

0 comments on commit 9185928

Please sign in to comment.