diff --git a/dinamis_sdk/utils.py b/dinamis_sdk/utils.py index 923a3244613dc76c831d275a6b9fc2fc17ad0210..817987b1e8c922ef94b5a22fe3772afb17c869d9 100644 --- a/dinamis_sdk/utils.py +++ b/dinamis_sdk/utils.py @@ -5,7 +5,8 @@ import json import appdirs from pydantic import BaseModel # pylint: disable = no-name-in-module -SIGNED_URL_TTL_MARGIN = 1800 # 30 minutes +# Signed TTL margin default to 1800 seconds (30 minutes), or env. var. +SIGNED_URL_TTL_MARGIN = os.environ.get("DINAMIS_SDK_TTL_MARGIN") or 1800 logging.basicConfig(level=os.environ.get("LOGLEVEL") or "INFO") log = logging.getLogger("dinamis_sdk") diff --git a/doc/advanced.md b/doc/advanced.md new file mode 100644 index 0000000000000000000000000000000000000000..0a60a75bb10298a68da570247f9e8bda49c02fbe --- /dev/null +++ b/doc/advanced.md @@ -0,0 +1,13 @@ +# Advanced use + +## Signed URLs time to live (TTL) margin + +Every signed URL has a TTL, returned by the signing URL API (`expiry`). +To prevent the expiry of one signed URL during a long process, a margin of +1800 seconds (30 minutes) is used by default. This duration can be changed +setting the environment variable `DINAMIS_SDK_TTL_MARGIN` to a number of +seconds. When one given URL has to be signed again, the cached URL will not be +used when the previous TTL minus the margin is negative. +30 minutes should be enough for most processing, however feel free to increase +this value to prevent your long process crashing, if it has started with one +URL with a short TTL. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 048cfd1515d354311e114b4d89ef4bdbddcf437d..9d8a8d10fb08954f318fbb3547192db309b516b5 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,6 +26,7 @@ plugins: nav: - Home: index.md - Credentials: credentials.md +- Advanced use: advanced.md - Additional resources: additional_resources.md - Examples: - Processing: processing_examples.md