Skip to content
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- The `CONNECT_TASK_TIMEOUT` environment variable, which configures the timeout for [task based operations](https://docs.posit.co/connect/api/#get-/v1/tasks/-id-). This value translates into seconds (e.g., `CONNECT_TASK_TIMEOUT=60` is equivalent to 60 seconds.) By default, this value is set to [`sys.maxsize`](https://docs.python.org/3/library/sys.html#sys.maxsize).
- The `CONNECT_TASK_TIMEOUT` environment variable, which configures the timeout for [task based operations](https://docs.posit.co/connect/api/#get-/v1/tasks/-id-). This value translates into seconds (e.g., `CONNECT_TASK_TIMEOUT=60` is equivalent to 60 seconds.) By default, this value is set to 86,400 seconds (e.g., 24 hours).

## [1.18.0] - 2023-06-27

Expand Down
5 changes: 2 additions & 3 deletions rsconnect/timeouts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
from typing import Union

from rsconnect.exception import RSConnectException
Expand All @@ -8,7 +7,7 @@
_CONNECT_REQUEST_TIMEOUT_DEFAULT_VALUE: str = "300"

_CONNECT_TASK_TIMEOUT_KEY: str = "CONNECT_TASK_TIMEOUT"
_CONNECT_TASK_TIMEOUT_DEFAULT_VALUE: str = str(sys.maxsize)
_CONNECT_TASK_TIMEOUT_DEFAULT_VALUE: str = "86400"


def get_request_timeout() -> int:
Expand Down Expand Up @@ -50,7 +49,7 @@ def get_task_timeout() -> int:

The timeout value is intended to be interpreted in seconds. A value of 60 is equal to sixty seconds, or one minute.

If CONNECT_TASK_TIMEOUT is unset, a default value of sys.maxsize is used.
If CONNECT_TASK_TIMEOUT is unset, a default value of 86,400 (1 day) is used.

If CONNECT_TASK_TIMEOUT is set to a value less or equal to 0, an `RSConnectException` is raised.

Expand Down
3 changes: 1 addition & 2 deletions tests/test_timeouts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys

from unittest import TestCase
from unittest.mock import patch
Expand Down Expand Up @@ -36,7 +35,7 @@ def test_get_negative_timeout_from_environment(self):
class GetTaskTimeoutTestCase(TestCase):
def test_get_default_timeout(self):
timeout = get_task_timeout()
self.assertEqual(sys.maxsize, timeout)
self.assertEqual(24 * 60 * 60, timeout)

def test_get_valid_timeout_from_environment(self):
with patch.dict(os.environ, {"CONNECT_TASK_TIMEOUT": "24"}):
Expand Down