Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retries to oleutil.GetProperty since we've seen this fail with some properties. #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions updates/updates_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,21 @@ func New(item *ole.IDispatch) (*Update, []error) {
continue
}
}

v, err := oleutil.GetProperty(u.Item, p)
if err != nil {
errs = append(errs, fmt.Errorf("get property %q: %w", p, err))
var v *ole.VARIANT
var err error
retries := 0
for {
v, err = oleutil.GetProperty(u.Item, p)
if err == nil {
break
}
if retries >= 1 {
errs = append(errs, fmt.Errorf("get property %q: %w", p, err))
break
}
retries++
}
if len(errs) > 0 {
continue
}

Expand Down
Loading