This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Conversation
bcf29ba to
93dcd98
Compare
dmjb
commented
Mar 12, 2025
| raise HTTPException(status_code=500, detail="Internal server error") | ||
|
|
||
|
|
||
| @cachetools.func.ttl_cache(maxsize=128, ttl=20 * 60) |
Contributor
Author
There was a problem hiding this comment.
Moved the caching here since I do not want to cache the backend calls.
dmjb
commented
Mar 12, 2025
| are trivial, and a simple hand-rolled solution is sufficient. | ||
| """ | ||
|
|
||
| def __init__(self, client: UpdateClient, interval_seconds: int = 14400): # 4 hours in seconds |
Contributor
Author
There was a problem hiding this comment.
Not sure if we want this interval to be externally configurable?
Call to the update service every four hours, and use the BE origin type. Print a warning level log message if an update is available. This PR also introduces some refactoring from the previous PR: 1) Refactor the update client to be a singleton. 2) Set the instance ID once on application load. 3) Get rid of the feature flag - using the new service is now default.
93dcd98 to
7cef43f
Compare
e783820 to
b784f20
Compare
dmjb
commented
Mar 12, 2025
|
|
||
| @patch("codegate.api.v1_processing.fetch_latest_version", return_value="foo") | ||
| def test_version_endpoint(mock_fetch_latest_version, test_client: TestClient) -> None: | ||
| @patch("codegate.api.v1._get_latest_version") |
Contributor
Author
There was a problem hiding this comment.
Ideally this test would use a patched out UpdateClient instance, but it's difficult to patch out a singleton with the mocks.
This sort of testing would be much easier if the V1 routes were defined in a class, and all dependencies were supplied via the constructor.
blkt
approved these changes
Mar 12, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Call to the update service every four hours, and use the BE origin type. Print a warning level log message if an update is available.
This PR also introduces some refactoring from the previous PR: