fix(history): preserve chronological replay ownership
This commit is contained in:
parent
4136528775
commit
efec80bc0e
2 changed files with 18 additions and 0 deletions
|
|
@ -30,6 +30,11 @@ PERSONAS = {
|
|||
PRIVATE_MARKERS = ("email", "token", "password", "secret", "api_key", "private_key")
|
||||
STREAM_BUFFER_BYTES = 1024 * 1024
|
||||
GPT_METADATA_SAMPLE_BYTES = 128 * 1024
|
||||
SOURCE_WAITING_STATUSES = {
|
||||
"PENDING",
|
||||
"WAITING_FOR_SOURCE",
|
||||
"WAITING_FOR_SOURCE_ACCEPTANCE",
|
||||
}
|
||||
|
||||
|
||||
def now_iso() -> str:
|
||||
|
|
@ -62,6 +67,11 @@ def classify_personas(text: str) -> list[str]:
|
|||
]
|
||||
|
||||
|
||||
def blocks_later_history(status: str) -> bool:
|
||||
"""An available active/error source owns the chronological replay lane."""
|
||||
return status != "COMPLETE" and status not in SOURCE_WAITING_STATUSES
|
||||
|
||||
|
||||
def iter_top_level_json_objects(
|
||||
handle: BinaryIO, start_offset: int = 0
|
||||
) -> Iterator[tuple[bytes, int]]:
|
||||
|
|
@ -753,6 +763,8 @@ class Runtime:
|
|||
self.process_source(source)
|
||||
if self.stop.is_set():
|
||||
break
|
||||
if blocks_later_history(self.store.state(source["id"])["status"]):
|
||||
break
|
||||
return self.write_public()
|
||||
|
||||
def run(self) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue