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

feat: Implement fillImage retries for elgato-mini and elgator-xl #1613

Merged
merged 3 commits into from
Jun 8, 2021
Merged

feat: Implement fillImage retries for elgato-mini and elgator-xl #1613

merged 3 commits into from
Jun 8, 2021

Conversation

bradleywehmeier
Copy link
Contributor

The standard lib/usb/elgato.js has a mechanism for retrying the fillImage call a couple of times before giving up on the USB device. This Pull Request applies that retry to the elgato-mini and elgato-xl.

The original retry logic was added as a result of a discussion on Issue #313 (comment)
In our use case, we had our Mini disconnect from its RPi4 when several image updates were made in quick succession. After running for a month now, we've seen debug logs where it would have disconnected before, but with the patched code it continues working just fine.
Note: I've tested with a Mini but not the XL since I don't have an XL but the code is otherwise identical.

@CLAassistant
Copy link

CLAassistant commented May 29, 2021

CLA assistant check
All committers have signed the CLA.

@krocheck krocheck requested a review from Julusian May 29, 2021 15:48
Copy link
Member

@Julusian Julusian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to do the retry from the point where we have newbuffer.
This change isnt guarding against sharp throwing an error, which I think is correct, but each time we retry it is sending the buffer back through sharp to do the same scaling.

Have you used async/await in js before? This function could really do with being rewritten to use that syntax and doing so would make the function possible to do as a while loop instead of chaining function calls

@bradleywehmeier
Copy link
Contributor Author

Good suggestion on the aysnc/await. I was trying to keep the change minimal, but I agree the async/await is more maintainable than chaining function calls.

@Julusian Julusian changed the title Implement fillImage retries for elgato-mini and elgator-xl feat: Implement fillImage retries for elgato-mini and elgator-xl Jun 8, 2021
@Julusian Julusian merged commit e998cac into bitfocus:master Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants