fix(일위대가실무): 339 덧고침 4 — 우리 지문 build() 가 메모(표 · 표판)까지 갱신 · warm() 중복 갱신 줄 지움
- 빈 캐시 폴더에서 table() 이 None 을 먼저 메모하면 build() 뒤에도 ready() 거짓 · 맞춤 「맞음」 0 이던 흠 - 시험: 캐시 쓰기 읽기 준비 전 none 에 build 직후 ready() 참 · table() = build 결과 한 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
This commit is contained in:
@@ -326,6 +326,8 @@ def build(ver: str | None = None) -> list[dict]:
|
|||||||
ver = ver or version()
|
ver = ver or version()
|
||||||
table = [fingerprint(one["로직"], one["단위"]) for one in hopyo_match.targets()["로직"]]
|
table = [fingerprint(one["로직"], one["단위"]) for one in hopyo_match.targets()["로직"]]
|
||||||
atomic_write_json(path_of(ver), {"판": ver, "지문판": FP_VERSION, "표": table})
|
atomic_write_json(path_of(ver), {"판": ver, "지문판": FP_VERSION, "표": table})
|
||||||
|
with _LOCK:
|
||||||
|
_STATE.update(표=table, 표판=ver)
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
@@ -351,10 +353,7 @@ def warm(build_missing: bool = False) -> threading.Thread | None:
|
|||||||
def work() -> None:
|
def work() -> None:
|
||||||
try:
|
try:
|
||||||
if table() is None and build_missing:
|
if table() is None and build_missing:
|
||||||
ver = version()
|
build(version())
|
||||||
got = build(ver)
|
|
||||||
with _LOCK:
|
|
||||||
_STATE.update(표=got, 표판=ver)
|
|
||||||
except Exception: # noqa: BLE001 — 마스터가 깨져도 서버를 막지 않음(보기에서 「준비 중」)
|
except Exception: # noqa: BLE001 — 마스터가 깨져도 서버를 막지 않음(보기에서 「준비 중」)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ def test_캐시_쓰기_읽기_준비_전_none(cache):
|
|||||||
built = ours.build()
|
built = ours.build()
|
||||||
assert [o["로직"] for o in built] == ["GC000198", "GC000211", "GC000268"]
|
assert [o["로직"] for o in built] == ["GC000198", "GC000211", "GC000268"]
|
||||||
assert ours.path_of().parent == cache and ours.path_of().is_file()
|
assert ours.path_of().parent == cache and ours.path_of().is_file()
|
||||||
|
assert ours.ready() and ours.table() == built
|
||||||
ours._STATE.update(표판=None, 표=None)
|
ours._STATE.update(표판=None, 표=None)
|
||||||
assert [o["로직"] for o in ours.table()] == ["GC000198", "GC000211", "GC000268"]
|
assert [o["로직"] for o in ours.table()] == ["GC000198", "GC000211", "GC000268"]
|
||||||
assert master_hash() == before
|
assert master_hash() == before
|
||||||
|
|||||||
Reference in New Issue
Block a user