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

Optimize the "News" function and add a timeout to curl requests #206

Closed
Antiz96 opened this issue Jul 8, 2024 · 0 comments · Fixed by #213
Closed

Optimize the "News" function and add a timeout to curl requests #206

Antiz96 opened this issue Jul 8, 2024 · 0 comments · Fixed by #213
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Antiz96
Copy link
Owner

Antiz96 commented Jul 8, 2024

Environment

  • Distribution: Arch-Linux
  • Arch-Update version: 2.2.0

Arch-Update configuration

None

Description of the bug

Currently, the "list/read News" feature of Arch-Update makes multiple curl requests to https://archlinux.org in order to extract and parse the list of recent news.
Some of those requests can take a long time on poor network connections (or during network instabilities) and they currently have no default timeout set, meaning they can result in an unexpected "freeze" (it's not actually frozen, just taking a very long time) for some people having a poor network connection (or being subject to network instabilities).

Screenshots / Logs

See this video at 12:54

https://youtu.be/on7iI-0a_Hw?si=2Ug54ZI_-KcUBXB-&t=774

Additional context

Here's a proposal to handle such cases at the Arch-Update level (as best as it can... It cannot fix people's network connection unfortunately 😝):

  • Print a message saying that Arch-Update is looking for recent Arch News (to avoid people thinking the script is just stuck in those situations)
  • Optimize the requests made to https://archlinux.org within the "News" function of the script by merging them (the first and second curl requests can be merged into one to avoid making multiple requests unnecessarily).
  • Add a default timeout to curl requests (--max-time option) to cut out/stop requests if they didn't finished after a reasonable time (30 sec?). In such cases, print a message to users like "Couldn't check for recent news in a reasonable time. Please, check https://archlinux.org/news/ for any recent news".
@Antiz96 Antiz96 added the bug Something isn't working label Jul 8, 2024
@Antiz96 Antiz96 added this to the v2.3.0 milestone Jul 8, 2024
@Antiz96 Antiz96 self-assigned this Jul 8, 2024
@Antiz96 Antiz96 changed the title Optimize the "News" function and a timeout for requests Optimize the "News" function and add a timeout to curl requests Jul 8, 2024
Antiz96 added a commit that referenced this issue Jul 9, 2024
This commit brings multiple improvements to the "News" function of the main script in order to optimize it and avoid unexpected behaviors:

- Print a message when Arch-Update is looking for recent Arch News (to avoid people thinking the script is just stuck in case it takes some time due to network instability/slowness)
- Print a message if no recent Arch News has been found since the last run
- Optimize the curl requests by merging the two first ones into a single one
- Add a default 30 sec timeout (`--max-time 30`) to curl requests so they don't end taking multiple minutes on slow/faulty network connection). If the timeout is reached, Arch-Update prints a warning explaining that it wasn't able to retrieve Arch News in a reasonable time, prints the URL of the Arch website or the URL of the selected news (so users can still look that up separately) and move on to the packages updates.

Fixes #206
@Antiz96 Antiz96 closed this as completed in a16a160 Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant