Skip to content

Commit

Permalink
Remove unnecessary final call in poll method
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Nov 20, 2024
1 parent 6c7b707 commit 6fff27d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,9 @@ def poll_sync(
"""
poll_start = datetime.now()
while True:
connector_details = self.get_connector_details(connector_id)
connector = FivetranConnector.from_connector_details(
connector_details=self.get_connector_details(connector_id)
connector_details=connector_details
)
self._log.info(f"Polled '{connector_id}'. Status: [{connector.sync_state}]")

Expand All @@ -712,16 +713,15 @@ def poll_sync(
# Sleep for the configured time interval before polling again.
time.sleep(poll_interval)

post_raw_connector_details = self.get_connector_details(connector_id)
if not connector.is_last_sync_successful:
raise Failure(
f"Sync for connector '{connector_id}' failed!",
metadata={
"connector_details": MetadataValue.json(post_raw_connector_details),
"connector_details": MetadataValue.json(connector_details),
"log_url": MetadataValue.url(connector.url),
},
)
return post_raw_connector_details
return connector_details


@experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ def test_basic_resource_request(
client.poll_sync(
connector_id=connector_id, previous_sync_completed_at=parser.parse(MIN_TIME_STR)
)
assert len(all_api_mocks.calls) == 2
assert len(all_api_mocks.calls) == 1

0 comments on commit 6fff27d

Please sign in to comment.