mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 03:15:08 +00:00
refactor(api): tidy leftovers from the api perf pass
Use the service_name local in handle_single_server_cdm, assign service_data once in /api/services, and keep the TERMINAL_STATUSES comment on its constant.
This commit is contained in:
@@ -92,8 +92,8 @@ class JobStatus(Enum):
|
|||||||
CANCELLED = "cancelled"
|
CANCELLED = "cancelled"
|
||||||
|
|
||||||
|
|
||||||
# Statuses a job can never leave; such jobs are safe to remove or retry.
|
|
||||||
WORKER_STDERR_LIMIT = 64 * 1024
|
WORKER_STDERR_LIMIT = 64 * 1024
|
||||||
|
# Statuses a job can never leave; such jobs are safe to remove or retry.
|
||||||
TERMINAL_STATUSES = (JobStatus.COMPLETED, JobStatus.FAILED, JobStatus.CANCELLED)
|
TERMINAL_STATUSES = (JobStatus.COMPLETED, JobStatus.FAILED, JobStatus.CANCELLED)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5139,7 +5139,7 @@ def handle_single_server_cdm(
|
|||||||
pr_drm.absorb(*siblings)
|
pr_drm.absorb(*siblings)
|
||||||
|
|
||||||
# Gate on the caller's CDM device first: no device, no keys from the vault or CDM.
|
# Gate on the caller's CDM device first: no device, no keys from the vault or CDM.
|
||||||
device_name = resolve_device_name(user_config, drm_type, service.__class__.__name__)
|
device_name = resolve_device_name(user_config, drm_type, service_name)
|
||||||
|
|
||||||
if refusal:
|
if refusal:
|
||||||
raise refusal
|
raise refusal
|
||||||
@@ -5166,7 +5166,7 @@ def handle_single_server_cdm(
|
|||||||
|
|
||||||
# Gate on the caller's CDM device first so a caller with no device cannot
|
# Gate on the caller's CDM device first so a caller with no device cannot
|
||||||
# harvest server-side keys from the vault fallback below.
|
# harvest server-side keys from the vault fallback below.
|
||||||
device_name = resolve_device_name(user_config, drm_type, service.__class__.__name__)
|
device_name = resolve_device_name(user_config, drm_type, service_name)
|
||||||
|
|
||||||
vault_hit = check_vaults(wv_drm.kids, service_name, shared=shared)
|
vault_hit = check_vaults(wv_drm.kids, service_name, shared=shared)
|
||||||
if vault_hit:
|
if vault_hit:
|
||||||
|
|||||||
@@ -515,11 +515,11 @@ async def services(request: web.Request) -> web.Response:
|
|||||||
services_info = []
|
services_info = []
|
||||||
|
|
||||||
for tag in service_tags:
|
for tag in service_tags:
|
||||||
service_data: dict[str, Any] = {**SERVICE_DEFAULTS, "tag": tag}
|
|
||||||
try:
|
try:
|
||||||
service_data = {**service_details(tag)}
|
service_data: dict[str, Any] = {**service_details(tag)}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"Could not load details for service {tag}: {e}")
|
log.warning(f"Could not load details for service {tag}: {e}")
|
||||||
|
service_data = {**SERVICE_DEFAULTS, "tag": tag}
|
||||||
if tag in services_module.PENDING:
|
if tag in services_module.PENDING:
|
||||||
service_data["pending_update"] = True
|
service_data["pending_update"] = True
|
||||||
if server_accounts_allowed(request, tag) and (server_accounts := server_account_regions(tag)) is not None:
|
if server_accounts_allowed(request, tag) and (server_accounts := server_account_regions(tag)) is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user