feat(cronjobs): add shared HTTP client wrapper. Refs #1214#1253
Open
Prasad8830 wants to merge 2 commits intoGreedyBear-Project:developfrom
Open
feat(cronjobs): add shared HTTP client wrapper. Refs #1214#1253Prasad8830 wants to merge 2 commits intoGreedyBear-Project:developfrom
Prasad8830 wants to merge 2 commits intoGreedyBear-Project:developfrom
Conversation
regulartim
requested changes
Apr 22, 2026
Member
regulartim
left a comment
There was a problem hiding this comment.
Hey @Prasad8830 ! Nice work overall! :) A few things though:
- The issue was also about standardized logging but I can see no logging here. Please add a sensible amount of logging and also be thoughtful with the log levels.
- The retry behavior is not actually tested. Please add some tests for that, especially for the POST + retry case.
16 tasks
Author
Thank you for bringing that to my attention! I will make the necessary corrections. |
16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR introduces a shared HTTP client wrapper (
HttpClient) based onrequests.Sessionfor our cronjob fetchers. This represents the first step towards standardising how cron jobs handle timeouts, retries, and errors, as discussed in #1214.The wrapper automatically applies a default 10-second timeout, implements an exponential backoff retry strategy for standard server errors/rate limits, and consistently enforces
raise_for_status(). Full unit tests for this wrapper have been included.Note: This PR only introduces the wrapper and its tests. Subsequent PRs will migrate
tor_exit_nodes,whatsmyip, and the remaining endpoints to use this new client.Related issues
Type of change
Checklist
Formalities
<feature name>. Closes #999develop.develop.Docs and tests
Ruff) gave 0 errors. If you have correctly installed pre-commit, it runs these checks and makes these adjustments on your behalf.GUI changes
Ignore this section if you did not make any changes to the GUI.