-
Notifications
You must be signed in to change notification settings - Fork 91
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
fix(projects): Treat fetch failures as pending #4140
Open
jjbayer
wants to merge
5
commits into
master
Choose a base branch
from
fix/project-failure-is-pending
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,17 +154,12 @@ def get_project_config(): | |
mini_sentry.clear_test_failures() | ||
|
||
|
||
def test_query_retry_maxed_out(mini_sentry, relay_with_processing, events_consumer): | ||
def test_query_retry_maxed_out(mini_sentry, relay): | ||
""" | ||
Assert that a query is not retried an infinite amount of times. | ||
|
||
This is not specific to processing or store, but here we have the outcomes | ||
consumer which we can use to assert that an event has been dropped. | ||
""" | ||
request_count = 0 | ||
|
||
events_consumer = events_consumer() | ||
|
||
original_get_project_config = mini_sentry.app.view_functions["get_project_config"] | ||
|
||
@mini_sentry.app.endpoint("get_project_config") | ||
|
@@ -184,9 +179,7 @@ def get_project_config(): | |
for retry in range(RETRIES): # 1 retry | ||
query_timeout += 1 * 1.5 ** (retry + 1) | ||
|
||
relay = relay_with_processing( | ||
{"limits": {"query_timeout": math.ceil(query_timeout)}} | ||
) | ||
relay = relay(mini_sentry, {"limits": {"query_timeout": math.ceil(query_timeout)}}) | ||
|
||
# No error messages yet | ||
assert mini_sentry.test_failures.empty() | ||
|
@@ -199,6 +192,12 @@ def get_project_config(): | |
assert {str(e) for _, e in mini_sentry.current_test_failures()} == { | ||
"Relay sent us event: error fetching project states: upstream request returned error 500 Internal Server Error: no error details", | ||
} | ||
|
||
time.sleep(1) # Wait for project to be cached | ||
|
||
# Relay still accepts events for this project | ||
next_response = relay.send_event(42) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the old version, this call raises a 403 error. |
||
assert "id" in next_response | ||
finally: | ||
mini_sentry.clear_test_failures() | ||
|
||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly a bit nicer to read with:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how
unwrap_or_else
only creates aProjectFetchState
in the error case.ProjectFetchState::pending()
callsInstant::now()
, so it's not entirely free.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part could be fixed by using
unwrap_or_else
, but I think the current version is fine as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went overboard with my example, I mainly meant the split of logging into the
inspect_err
, keep the side effect separate from the conversion. But either way it's fine and possibly worse with the how rustfmt wants to format it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but then you need to ignore the argument passed to
unwrap_or_else
(the error), that you previously inspected withinspect_err
. Is that better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think the current version is superior.