feat: sync execution with 3s progress polling (stage 2)
- pulp_client: get_repo / sync_repo / get_task (비동기 task href 반환)
- POST /repos/{uuid}/sync: remote 확인 후 동기화 시작, 진행률 조각 반환
- GET /repos/{uuid}/progress: progress_reports 합산 → 바/퍼센트,
완료/실패 시 hx-trigger 제거로 폴링 중단
- task_store: uuid→task_href 메모리 추적 (단일 인스턴스), 대시보드 '동기화 중' 집계
- views.task_progress: state/done/total/percent + created_resources에서 새 vN
- 동기화는 안전 동작이라 확인 모달 없이 실행 (스펙 §5-1)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
app/task_store.py
Normal file
26
app/task_store.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""진행 중 동기화 task 의 메모리 저장소 (uuid → task_href).
|
||||
|
||||
폐쇄망 단일 인스턴스 가정. 다중 워커/프로세스로 띄우면 워커 간 공유되지 않으므로,
|
||||
규모가 커지면 Redis 등 외부 저장소로 교체해야 한다. 폴링 자체는 화면(HTMX)이 한다(스펙 §7).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
_active: dict[str, str] = {}
|
||||
|
||||
|
||||
def set_task(uuid: str, task_href: str) -> None:
|
||||
_active[uuid] = task_href
|
||||
|
||||
|
||||
def get_task(uuid: str) -> str | None:
|
||||
return _active.get(uuid)
|
||||
|
||||
|
||||
def clear_task(uuid: str) -> None:
|
||||
_active.pop(uuid, None)
|
||||
|
||||
|
||||
def active_count() -> int:
|
||||
"""대시보드 '동기화 중' 카드용 — 아직 완료/실패로 정리되지 않은 sync 수."""
|
||||
return len(_active)
|
||||
Reference in New Issue
Block a user