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
1 change: 1 addition & 0 deletions .env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ FUNCTION_SERVICES_AUTHORS='{"UN": {"name": "Unknown", "email": "[email protected]

WEBSERVER_LICENSES={}
LICENSES_ITIS_VIP_SYNCER_ENABLED=false
LICENSES_ITIS_VIP_SYNCER_PERIODICITY=1D00:00:00
LICENSES_ITIS_VIP_API_URL=https://replace-with-itis-api/{category}
LICENSES_ITIS_VIP_CATEGORIES='{"HumanWholeBody": "Humans", "HumanBodyRegion": "Humans (Region)", "AnimalWholeBody": "Animal"}'
LICENSES_SPEAG_PHANTOMS_API_URL=https://replace-with-speag-api/{category}
Expand Down
1 change: 1 addition & 0 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ services:

WEBSERVER_LICENSES: ${WEBSERVER_LICENSES}
LICENSES_ITIS_VIP_SYNCER_ENABLED : ${LICENSES_ITIS_VIP_SYNCER_ENABLED}
LICENSES_ITIS_VIP_SYNCER_PERIODICITY: ${LICENSES_ITIS_VIP_SYNCER_PERIODICITY}
LICENSES_ITIS_VIP_API_URL: ${LICENSES_ITIS_VIP_API_URL}
LICENSES_ITIS_VIP_CATEGORIES: ${LICENSES_ITIS_VIP_CATEGORIES}
LICENSES_SPEAG_PHANTOMS_API_URL: ${LICENSES_SPEAG_PHANTOMS_API_URL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def _lifespan(app_: web.Application):
@exclusive_periodic(
get_redis_lock_manager_client_sdk(app_),
task_interval=resync_after,
retry_after=timedelta(minutes=2),
retry_after=timedelta(minutes=1),
)
async def _periodic_sync() -> None:
await sync_licensed_resources(app_, categories=categories)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# pylint: disable=protected-access
# pylint: disable=redefined-outer-name
# pylint: disable=too-many-arguments
# pylint: disable=unused-argument
# pylint: disable=unused-variable


import datetime

import pytest
from pytest_simcore.helpers.typing_env import EnvVarsDict
from simcore_service_webserver.licenses.settings import LicensesSettings


def test_itis_vip_syncer_settings(
mock_webserver_service_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch
):

assert "LICENSES_ITIS_VIP_SYNCER_ENABLED" in mock_webserver_service_environment
assert "LICENSES_ITIS_VIP_SYNCER_PERIODICITY" in mock_webserver_service_environment

settings = LicensesSettings.create_from_envs()
assert settings

with monkeypatch.context() as patch:
patch.setenv("LICENSES_ITIS_VIP_SYNCER_PERIODICITY", "1D02:03:04")

settings: LicensesSettings = LicensesSettings.create_from_envs()
assert settings
assert settings.LICENSES_ITIS_VIP_SYNCER_PERIODICITY == datetime.timedelta(
days=1, hours=2, minutes=3, seconds=4
)
Loading