Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this patch does
In the existing code, the URL received in the
/present/still
request is passed directly tofeh
, which then handles all the work of requesting the image from the webcam over HTTP.This PR makes it so the Node process requests the image, then pipes that image into
feh
over stdin.Upsides of this patch
In testing, the image was presented about a quarter of a second faster after sending the presentation request (although the actual latency before fetching the image was unaffected), and the previous instance of
feh
was preserved for another quarter-second longer (leading to something like an overall reduction of a half a second of blank screen time, when presenting multiple stills).Note that this patch did not appear to have a noticeable impact on the latency of the requested image itself: while I didn't specifically test image request latency, the loaded image's on-screen timestamp always matched the
date
of the request to the second regardless of implementation. This performance boost is only a presentation detail.Downsides to this patch
Requesting the image necessitates the introduction of
node-fetch
to do cleanly, which entails its own further dependencies in turn (see the changes to the lockfile), and has an uncertain maintenance future due to turmoil in the ecosystem. Further updates to this dependency are likely to introduce friction with the minimum supported Node runtime version, which is already a pain to manage on Raspbian. (Ideally, thisfetch
functionality would be part of Node's core, but that's in the air at the moment, too.)