Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion airbyte_cdk/sources/streams/http/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ def __init__(
if session:
self._session = session
else:
self._use_cache = use_cache
# TEMPORARY: Force disable cache to prevent unbounded memory growth from
# requests_cache SQLite backend accumulating cached HTTP responses in memory.
# See: https://github.com/airbytehq/airbyte-python-cdk/pull/952
self._use_cache = False
self._session = self._request_session()
self._session.mount(
"https://",
Expand Down
2 changes: 2 additions & 0 deletions unit_tests/sources/streams/http/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def test_parent_attribute_exist():
assert child_stream.parent == parent_stream


@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
def test_that_response_was_cached(mocker, requests_mock):
requests_mock.register_uri("GET", "https://google.com/", text="text")
stream = CacheHttpStream()
Expand Down Expand Up @@ -547,6 +548,7 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
yield {"value": len(response.text)}


@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
@patch("airbyte_cdk.sources.streams.core.logging", MagicMock())
def test_using_cache(mocker, requests_mock):
requests_mock.register_uri("GET", "https://google.com/", text="text")
Expand Down
3 changes: 3 additions & 0 deletions unit_tests/sources/streams/http/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_cache_filename():
http_client.cache_filename == f"{http_client._name}.sqlite"


@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
@pytest.mark.parametrize(
"use_cache, expected_session",
[
Expand Down Expand Up @@ -447,6 +448,7 @@ def test_session_request_exception_raises_backoff_exception():
http_client._send(prepared_request, {})


@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
def test_that_response_was_cached(requests_mock):
cached_http_client = test_cache_http_client()

Expand Down Expand Up @@ -720,6 +722,7 @@ def test_backoff_strategy_endless(
assert mocked_send.call_count == expected_call_count


@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
def test_given_different_headers_then_response_is_not_cached(requests_mock):
http_client = HttpClient(name="test", logger=MagicMock(), use_cache=True)
first_request_headers = {"header_key": "first"}
Expand Down
1 change: 1 addition & 0 deletions unit_tests/sources/streams/test_call_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def test_without_cache(self, mocker, requests_mock):

assert MovingWindowCallRatePolicy.try_acquire.call_count == 10

@pytest.mark.skip(reason="TEMPORARY: cache is hardcoded off in HttpClient to prevent unbounded memory growth")
@pytest.mark.usefixtures("enable_cache")
def test_with_cache(self, mocker, requests_mock):
"""Test that HttpStream will use call budget when provided and not cached"""
Expand Down
Loading