Skip to content

Commit 9196801

Browse files
committed
Address feedbacks
1 parent 01d14d8 commit 9196801

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/snowflake/cli/_plugins/remote/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ServiceResult(enum.Enum):
9999
RAY_DASHBOARD_ENDPOINT_NAME = "ray-dashboard"
100100

101101
# SSH Configuration
102-
DEFAULT_SSH_REFRESH_INTERVAL = 300 # 5 minutes
102+
DEFAULT_SSH_REFRESH_INTERVAL = 2700 # 45 minutes
103103
SSH_RETRY_INTERVAL = 30 # 30 seconds
104104
SSH_COUNTDOWN_INTERVAL = 30 # Show countdown every 30 seconds
105105
SSH_DIR_NAME = ".ssh"

src/snowflake/cli/_plugins/remote/manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def _ssh_token_refresh_loop(
877877
raise CliError(f"SSH error occurred: {str(e)}")
878878

879879
def _get_fresh_token(self) -> str:
880-
"""Get a fresh authentication token with natural session expiration.
880+
"""Get a fresh authentication token with session keep-alive enabled.
881881
882882
Creates a connection that will expire naturally according to Snowflake's
883883
default session timeout, allowing proper token lifecycle management
@@ -890,12 +890,12 @@ def _get_fresh_token(self) -> str:
890890

891891
current_context = get_cli_context().connection_context
892892

893-
# Create connection with natural session expiration for SSH token refresh
893+
# Create connection with session keep-alive enabled for SSH token refresh
894894
fresh_connection = connect_to_snowflake(
895895
connection_name=current_context.connection_name,
896896
temporary_connection=current_context.temporary_connection,
897-
# Allow session to expire naturally - don't keep it alive artificially
898-
using_session_keep_alive=False,
897+
# Enable session keep-alive to prevent session expiry
898+
using_session_keep_alive=True,
899899
)
900900

901901
# Track the connection and proactively cap the number of live temp connections

tests/remote/test_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,11 @@ def test_get_fresh_token_success(self, mock_get_context, mock_connect):
629629
mock_connect.assert_called_once_with(
630630
connection_name="test_conn",
631631
temporary_connection=False,
632-
using_session_keep_alive=False,
632+
using_session_keep_alive=True,
633633
)
634634
mock_cursor.execute.assert_called_once_with(
635635
"ALTER SESSION SET python_connector_query_result_format = 'JSON'"
636636
)
637-
# Connection is designed to expire naturally, no explicit close
638637

639638
@patch("snowflake.cli._app.snow_connector.connect_to_snowflake")
640639
@patch("snowflake.cli._plugins.remote.manager.get_cli_context")

0 commit comments

Comments
 (0)