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

refactor: merge all /trails requests when idle #149

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

anibalportero
Copy link
Contributor

@anibalportero anibalportero commented Oct 24, 2022

Before this PR, we were making 5 GET requests when idle for every cycle:

  • trails/ to check if the device was synced
  • trails/id/steps/requests?progress.status=NEW to list NEW pending revisions
  • trails/id/steps/requests?progress.status=QUEUED
  • trails/id/steps/requests?progress.status=DOWNLOADING
  • trails/id/steps/requests?progress.status=INPROGRESS

With this PR, we reduce the number of request per cycle:

  • trails/id/steps/requests?progress.status=%7B%22$in%22:%5B%22NEW%22,%22DOWNLOADING%22,%22INPROGRESS%22,%22QUEUED%22%5D%7D is now done to request all pending revisions with just one request
  • trails/id/steps/requests?progress.status=NEW is still used to send all NEW revisions into QUEUED while an update is being installed
  • trails/ is still used but just once for each reboot. After determining whether the device is synced or not, we remember it by storing it in pv struct

@anibalportero anibalportero marked this pull request as draft October 24, 2022 11:32
@anibalportero anibalportero changed the title reduce trail queries per WAIT cycle by using the same filter for NEW, DOWNLOADING and QUEUED refactor: merge all /trails requests when idle Sep 4, 2024
@anibalportero anibalportero marked this pull request as ready for review September 5, 2024 05:30
Previously, we were doing a GET request to /trails plus
four additional GET /trails for each of the pending status
(NEW, QUEUED, INPROGRESS and DOWNLOADING).

With this commit, we try to mix the four requests into one
and only use /trails once per reboot.
@anibalportero anibalportero merged commit 6b1b269 into master Sep 6, 2024
2 checks passed
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.

1 participant