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

fix(connector-builder): add flag to disable cache #45095

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def create_source(config: Mapping[str, Any], limits: TestReadLimits) -> Manifest
limit_pages_fetched_per_slice=limits.max_pages_per_slice,
limit_slices_fetched=limits.max_slices,
disable_retries=True,
disable_cache=True,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ def __init__(
limit_slices_fetched: Optional[int] = None,
emit_connector_builder_messages: bool = False,
disable_retries: bool = False,
disable_cache: bool = False,
message_repository: Optional[MessageRepository] = None,
):
self._init_mappings()
self._limit_pages_fetched_per_slice = limit_pages_fetched_per_slice
self._limit_slices_fetched = limit_slices_fetched
self._emit_connector_builder_messages = emit_connector_builder_messages
self._disable_retries = disable_retries
self._disable_cache = disable_cache
self._message_repository = message_repository or InMemoryMessageRepository( # type: ignore
self._evaluate_log_level(emit_connector_builder_messages)
)
Expand Down Expand Up @@ -825,6 +827,8 @@ def create_http_requester(self, model: HttpRequesterModel, decoder: Decoder, con
assert model.use_cache is not None # for mypy
assert model.http_method is not None # for mypy

use_cache = model.use_cache and not self._disable_cache

return HttpRequester(
name=name,
url_base=model.url_base,
Expand All @@ -837,7 +841,7 @@ def create_http_requester(self, model: HttpRequesterModel, decoder: Decoder, con
disable_retries=self._disable_retries,
parameters=model.parameters or {},
message_repository=self._message_repository,
use_cache=model.use_cache,
use_cache=use_cache,
decoder=decoder,
stream_response=decoder.is_stream_response() if decoder else False,
)
Expand Down Expand Up @@ -1199,6 +1203,7 @@ def _create_message_repository_substream_wrapper(self, model: ParentStreamConfig
limit_slices_fetched=self._limit_slices_fetched,
emit_connector_builder_messages=self._emit_connector_builder_messages,
disable_retries=self._disable_retries,
disable_cache=self._disable_cache,
message_repository=LogAppenderMessageRepositoryDecorator(
{"airbyte_cdk": {"stream": {"is_substream": True}}, "http": {"is_auxiliary": True}},
self._message_repository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ def test_create_source():
assert isinstance(source, ManifestDeclarativeSource)
assert source._constructor._limit_pages_fetched_per_slice == limits.max_pages_per_slice
assert source._constructor._limit_slices_fetched == limits.max_slices
assert source._constructor._disable_cache


def request_log_message(request: dict) -> AirbyteMessage:
Expand Down
Loading