refactor: clarify publication recovery count
This commit is contained in:
@@ -422,20 +422,16 @@ def run_collection(
|
||||
if history_path.exists():
|
||||
import_legacy_history(conn, history_path, clock=clock)
|
||||
|
||||
recovered_count = _recover_pending_for_collection(conn)
|
||||
published_count = _recover_pending_for_collection(conn)
|
||||
|
||||
# Hold the writer reservation across the capacity check and acquisition.
|
||||
# A concurrent collector will recheck pending work before it acquires.
|
||||
while True:
|
||||
conn.execute("BEGIN IMMEDIATE")
|
||||
waiting = _pending_count(conn)
|
||||
if waiting >= PENDING_PUBLICATION_LIMIT:
|
||||
conn.rollback()
|
||||
recovered_count += _recover_pending_for_collection(conn)
|
||||
continue
|
||||
if waiting:
|
||||
conn.rollback()
|
||||
recovered_count += _recover_pending_for_collection(conn)
|
||||
published_count += _recover_pending_for_collection(conn)
|
||||
continue
|
||||
|
||||
from .tz_util import detect_system_tz
|
||||
@@ -458,10 +454,10 @@ def run_collection(
|
||||
conn.commit()
|
||||
break
|
||||
|
||||
recovered_count += _recover_pending_for_collection(conn)
|
||||
published_count += _recover_pending_for_collection(conn)
|
||||
return {
|
||||
"ok": True,
|
||||
"sample_count": recovered_count,
|
||||
"sample_count": published_count,
|
||||
"store_path": str(store_path),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user