update macos wifi refresh and logout clear
This commit is contained in:
@@ -662,14 +662,20 @@ func (a *App) authStorageScanner() {
|
||||
|
||||
// monitorLoop định kỳ 10s: check wifi, ping backend, cập nhật online/offline seconds và đồng bộ lên server
|
||||
func (a *App) monitorLoop() {
|
||||
ticker := time.NewTicker(10 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
a.runMonitorTick()
|
||||
|
||||
for {
|
||||
<-ticker.C
|
||||
a.runMonitorTick()
|
||||
|
||||
a.mu.Lock()
|
||||
wifiEmpty := a.wifiSSID == "" || strings.Contains(a.wifiSSID, "Chưa cấp quyền") || strings.Contains(a.wifiSSID, "redacted")
|
||||
expecting := a.expectingLogin
|
||||
a.mu.Unlock()
|
||||
|
||||
sleepInterval := 10 * time.Second
|
||||
if wifiEmpty && !expecting {
|
||||
sleepInterval = 2 * time.Second
|
||||
}
|
||||
|
||||
time.Sleep(sleepInterval)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user