1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-13 07:42:46 -04:00

system update: make refresh synchronous

This commit is contained in:
bbedward
2026-04-30 11:41:07 -04:00
parent 86096db26b
commit 2877c63c97
+8 -1
View File
@@ -38,6 +38,8 @@ type Manager struct {
acquireCount int32 acquireCount int32
wakeSched chan struct{} wakeSched chan struct{}
refreshSerial sync.Mutex
opMu sync.Mutex opMu sync.Mutex
opCtx context.Context opCtx context.Context
opCancel context.CancelFunc opCancel context.CancelFunc
@@ -143,9 +145,11 @@ func (m *Manager) Refresh(opts RefreshOptions) {
case phase == PhaseUpgrading: case phase == PhaseUpgrading:
return return
case phase == PhaseRefreshing && !opts.Force: case phase == PhaseRefreshing && !opts.Force:
m.refreshSerial.Lock()
m.refreshSerial.Unlock()
return return
} }
go m.runRefresh(context.Background()) m.runRefresh(context.Background())
} }
func (m *Manager) Upgrade(opts UpgradeOptions) error { func (m *Manager) Upgrade(opts UpgradeOptions) error {
@@ -226,6 +230,9 @@ func (m *Manager) scheduler() {
} }
func (m *Manager) runRefresh(parent context.Context) { func (m *Manager) runRefresh(parent context.Context) {
m.refreshSerial.Lock()
defer m.refreshSerial.Unlock()
if len(m.selection.All()) == 0 { if len(m.selection.All()) == 0 {
return return
} }