Skip to content

Commit 398909c

Browse files
make polling interval a separate constant
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent c038f22 commit 398909c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/databricks/sql/backend/sea/backend.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ class SeaDatabricksClient(DatabricksClient):
8585
STATEMENT_PATH_WITH_ID = STATEMENT_PATH + "/{}"
8686
CANCEL_STATEMENT_PATH_WITH_ID = STATEMENT_PATH + "/{}/cancel"
8787

88+
# SEA API constants
89+
POLLING_INTERVAL_SECONDS = 0.5
90+
8891
def __init__(
8992
self,
9093
server_hostname: str,
@@ -456,7 +459,7 @@ def execute_command(
456459

457460
# Keep polling until we reach a terminal state
458461
while state in [CommandState.PENDING, CommandState.RUNNING]:
459-
time.sleep(0.5) # add a small delay to avoid excessive API calls
462+
time.sleep(self.POLLING_INTERVAL_SECONDS)
460463
state = self.get_query_state(command_id)
461464

462465
if state != CommandState.SUCCEEDED:

0 commit comments

Comments
 (0)