feat(solution): 발행 워커·버전 관리와 예약·미리보기 정리
상시 프리렌더와 중복 예약 안내를 없애고, 검수된 발행 버전을 보존한다. 미리보기는 실제 렌더 완료까지 스피너를 표시한다. 사이트 81건, 발행·롤백·서치콘솔 45건, 프로세스 수명 3건 통과. 빌더·사이트 빌드 및 compose 설정 검증 통과.
This commit is contained in:
1 parent
0f7d22750f
commit
f2087aad5e
207 files changed
+8424
-4429
No files matched your search
@@ -29,6 +29,7 @@ from router.v1.site.protocol import (
|
||||
Req_SiteStatus,
|
||||
Req_SiteTemplate,
|
||||
Req_SiteTheme,
|
||||
Req_Rollback,
|
||||
Req_StartBuild,
|
||||
Res_MySites,
|
||||
Res_PublishLogs,
|
||||
@@ -166,7 +167,7 @@ class SiteService:
|
||||
(`snapshot.build_snapshot` → `site_payload.prepare_site_payload`)를 그대로 거치므로,
|
||||
여기서 갈릴 자리가 없다. 버전은 아직 없으니 0 으로 넘긴다 — 화면에 안 쓰인다.
|
||||
"""
|
||||
from services.build_service import ensure_site, _load_links
|
||||
from services.build_service import ensure_site, load_channel_links
|
||||
from services.site_payload import prepare_site_payload
|
||||
from services.snapshot import build_snapshot
|
||||
|
||||
@@ -175,7 +176,7 @@ class SiteService:
|
||||
return None
|
||||
|
||||
site = await ensure_site(place_id)
|
||||
links = await _load_links(place_id)
|
||||
links = await load_channel_links(place_id)
|
||||
snapshot = await build_snapshot(place)
|
||||
# ★ version 은 None 이다. 발행 전이라 버전 행이 없고, payload 의 site.version 은
|
||||
# 캐시 무효화 키라 미리보기에서는 뜻이 없다(to_site_payload 가 0 으로 떨어뜨린다).
|
||||
@@ -570,6 +571,35 @@ class SiteService:
|
||||
res.created = created
|
||||
return res
|
||||
|
||||
async def start_rollback(self, user_info: UserInfo, place_id: str, req: Req_Rollback) -> Res_StartBuild:
|
||||
"""예전 버전으로 공개 주소를 되돌리는 잡을 큐에 넣는다.
|
||||
|
||||
★ dedupe_key 를 빌드와 **같은 것**(`build:{place_id}`)을 쓴다 — 롤백 도중에 새 발행이
|
||||
끼어들거나 그 반대가 되면 어느 쪽이 이겼는지 알 수 없는 상태가 된다. 이 사이트의
|
||||
공개 주소를 바꾸는 작업은 항상 하나만 활성화된다."""
|
||||
res = Res_StartBuild()
|
||||
err_type, _place = await self._load_place(user_info, place_id)
|
||||
if err_type != ErrorType.SUCCESS:
|
||||
res.result.SetResult(err_type)
|
||||
return res
|
||||
|
||||
job_id, created = await enqueue_job(
|
||||
self.queue, JobType.ROLLBACK,
|
||||
{
|
||||
"place_id": place_id, "owner_user_id": user_info.user_id,
|
||||
"target_version": req.target_version, "requested_by": user_info.user_id,
|
||||
},
|
||||
dedupe_key=f"build:{place_id}",
|
||||
)
|
||||
if job_id is None:
|
||||
res.result.SetResult(ErrorType.COLLECT_ALREADY_RUNNING)
|
||||
return res
|
||||
|
||||
res.job_id = uuid.UUID(job_id)
|
||||
res.status = JobStatus.PENDING
|
||||
res.created = created
|
||||
return res
|
||||
|
||||
async def list_versions(self, user_info: UserInfo, place_id: str) -> Res_SiteVersions:
|
||||
from sqlalchemy import select
|
||||
|
||||
|
||||
Reference in new issue
Block a user