-
Notifications
You must be signed in to change notification settings - Fork 38
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
Hot fix for unpacked value error #153
Conversation
tap_zendesk/http.py
Outdated
try: | ||
response_json = await response.json() | ||
except ContentTypeError as e: | ||
LOGGER.warning("Error decoding response from API: %s", str(e)) | ||
except ValueError as e: | ||
LOGGER.warning("Invalid response from API: %s", str(e)) |
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.
If we are just logging the error, it makes sense to catch both exceptions together. This simplifies the code and reduces redundancy. Also the logger will include the exception details, making it easier to trace the issue.
try: | |
response_json = await response.json() | |
except ContentTypeError as e: | |
LOGGER.warning("Error decoding response from API: %s", str(e)) | |
except ValueError as e: | |
LOGGER.warning("Invalid response from API: %s", str(e)) | |
try: | |
response_json = await response.json() | |
except (ContentTypeError, ValueError) as e: | |
LOGGER.warning("Error decoding response from API. Exception: %s", e, exc_info=True) |
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.
Agree
@@ -0,0 +1,255 @@ | |||
import unittest | |||
from unittest.mock import patch, MagicMock | |||
from aioresponses import aioresponses |
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.
Can we try using unittest.mock.AsyncMock
instead of third party module aioresponses
?
test/unittests/test_http.py
Outdated
@@ -4,7 +4,9 @@ | |||
import requests | |||
from urllib3.exceptions import ProtocolError | |||
from requests.exceptions import ChunkedEncodingError, ConnectionError | |||
|
|||
from aioresponses import aioresponses |
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.
Can we try using unittest.mock.AsyncMock instead of third party module aioresponses?
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.
Removed aioresponses
def test_sync_audits_comments_stream__both_not_selected(self, mock_info, mock_capture, mock_write_state, mock_check_access, mock_get_objects, mock_get_bookmark, mock_update_bookmark): | ||
""" | ||
Test that audits and comments are processed and emitted when the respective streams are selected. | ||
""" |
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.
Comment seems incorrect.
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.
Requested few changes.
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.
Looks good to me.
Hi @RushiT0122 @prijendev this is causing rate limit issues it looks like the code is not properly reading the retry and its spamming our zendesk api and hitting organization limit issues. The issue started happening around the time of this code release
This spams above and then below the retry is 0.0s?
Could we please get a second set of eyes on this, the decorator is set to 0 as the interval for refresh, shouldn't it be the amount in the header? |
Hi @sheresaidon, we are aware of this issue and have already begun working on it. We plan to provide the fix by the beginning of the second week. Thank you for your patience. |
@prijendev is there anything i can do to help speed this up? can you share any potentially temporary workarounds? |
The fix for this issue is ready. You could refer this PR |
|
We have some process to release it. we will merge on Monday. Thank you for your patience. |
Thank you! |
Description of change
Hotfix for PR#150.
Manual QA steps