Skip to content

Commit

Permalink
refactor: optimize install app task
Browse files Browse the repository at this point in the history
  • Loading branch information
bitxeno committed Jun 25, 2024
1 parent 5e6a155 commit 822f893
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,19 @@ func (t *Task) StartInstallApp(v model.InstalledApp) {
func (t *Task) tryInstallApp(v model.InstalledApp) {
log.Infof("Start installing ipa: %s", v.IpaName)
var err error
err = t.runInternal(v)
// AppleTV system has reboot/lockdownd sleep, try restart usbmuxd to fix
// LOCKDOWN_E_MUX_ERROR / AFC_E_MUX_ERROR /
err = manager.CheckAfcServiceStatus(v.UDID)
if err != nil {
log.Infof("Try restarting usbmuxd to fix connect issue. %s", v.IpaName)
log.Err(err).Msgf("Afc service can't connect. %s", v.IpaName)
log.Infof("Try restarting usbmuxd to fix afc connect issue. %s", v.IpaName)
if err = manager.RestartUsbmuxd(); err == nil {
log.Infof("Restart usbmuxd complete, try install ipa again. %s", v.IpaName)
time.Sleep(5 * time.Second)
err = t.runInternal(v)
}
} else {
err = t.runInternal(v)
}

now := time.Now()
Expand Down

0 comments on commit 822f893

Please sign in to comment.