Skip to content

Commit

Permalink
Merge pull request #268 from DevDataPlatform/267-increase-abreq-timeo…
Browse files Browse the repository at this point in the history
…ut-for-checking-connections

add "timeout" kwarg to abreq
  • Loading branch information
fatchat authored Aug 10, 2023
2 parents c370f17 + 36a13e9 commit f168cd0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ddpui/ddpairbyte/airbyte_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logger = CustomLogger("airbyte")


def abreq(endpoint, req=None):
def abreq(endpoint, req=None, **kwargs):
"""Request to the airbyte server"""
abhost = os.getenv("AIRBYTE_SERVER_HOST")
abport = os.getenv("AIRBYTE_SERVER_PORT")
Expand All @@ -33,7 +33,7 @@ def abreq(endpoint, req=None):
f"http://{abhost}:{abport}/api/{abver}/{endpoint}",
headers={"Authorization": f"Basic {token}"},
json=req,
timeout=30,
timeout=kwargs.get("timeout", 30),
)
except requests.exceptions.ConnectionError as conn_error:
logger.exception(conn_error)
Expand Down Expand Up @@ -324,6 +324,7 @@ def check_source_connection(workspace_id: str, data: AirbyteSourceCreate) -> dic
"connectionConfiguration": data.config,
"workspaceId": workspace_id,
},
timeout=60,
)
if "jobInfo" not in res or res.get("status") == "failed":
logger.error("Failed to check source connection: %s", res)
Expand All @@ -342,6 +343,7 @@ def check_source_connection_for_update(
"connectionConfiguration": data.config,
"name": data.name,
},
timeout=60,
)
if "jobInfo" not in res or res.get("status") == "failed":
logger.error("Failed to check source connection: %s", res)
Expand Down Expand Up @@ -534,6 +536,7 @@ def check_destination_connection(
"connectionConfiguration": data.config,
"workspaceId": workspace_id,
},
timeout=60,
)
if "jobInfo" not in res or res.get("status") == "failed":
logger.error("Failed to check destination connection: %s", res)
Expand All @@ -555,6 +558,7 @@ def check_destination_connection_for_update(
"connectionConfiguration": data.config,
"name": data.name,
},
timeout=60,
)
if "jobInfo" not in res or res.get("status") == "failed":
logger.error("Failed to check destination connection: %s", res)
Expand Down

0 comments on commit f168cd0

Please sign in to comment.