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

[SYNSD-1233] Adding in a try/catch for HTTP 409 conflicts on entity creation #1131

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

BryanFauble
Copy link
Contributor

Problem:

  1. If an HTTP Read error occurs when receiving back the response from creating a Synapse entity an HTTP 409 error will be thrown when the request is retried.

Solution:

  1. Try out removing the ReadError and ReadTimeout as exceptions that are retried. Instead let the SynapseHTTPError be raised and wrap the POST call in a try/except that will get the entity from Synapse if it was a conflict, then compare the results to what the expected state was.

Testing:

  1. I did very light manual testing for this by running the syncToSynapse command and I manually triggered the exception to be raised.

@pep8speaks
Copy link

pep8speaks commented Sep 20, 2024

Hello @BryanFauble! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 67:89: E501 line too long (225 > 88 characters)
Line 72:89: E501 line too long (113 > 88 characters)
Line 76:89: E501 line too long (187 > 88 characters)

Line 11:1: F401 'httpcore._backends.anyio.AnyIOStream' imported but unused
Line 161:89: E501 line too long (221 > 88 characters)

Comment last updated at 2024-09-27 19:12:34 UTC

spy_tls_stream.spy_return
)
call_count = call_count + 1
# This is very brittle, however, I do not see data to determine what the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 Does that mean if we add functions called in the async stream that we would have edit this call_count?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if more or less calls occur during the store_async function we would need to adjust this call count.

This specific way of replacing the read isn't working on GH actions. Though I did confirm the logic is working on my local machine. This needs to be fixed, but more digging into this is needed. I can get the hostname/IP addresses used, but being this "far" down in the libraries and working directly in httpcore, I lose a lot of context like request headers and the uri.

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.

3 participants