sync errors
This commit is contained in:
@@ -2,6 +2,7 @@ import io
|
||||
import logging
|
||||
import shlex
|
||||
import socket
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
@@ -81,12 +82,17 @@ def test_connection(cfg: SFTPConfig) -> tuple[bool, str]:
|
||||
def list_new_zips(cfg: SFTPConfig, max_results: int | None = None) -> list[RemoteZip]:
|
||||
transport = _make_transport(cfg)
|
||||
try:
|
||||
t0 = time.monotonic()
|
||||
all_zips = _find_remote_zips(transport, cfg.remote_path)
|
||||
log.info("Remote scan done: %d zip(s) found", len(all_zips))
|
||||
log.info("Remote find done in %.1fs — %d zip(s) found", time.monotonic() - t0, len(all_zips))
|
||||
|
||||
t1 = time.monotonic()
|
||||
processed = db.get_all_processed_paths()
|
||||
log.info("DB lookup done in %.1fs — %d path(s) already processed", time.monotonic() - t1, len(processed))
|
||||
|
||||
new_zips: list[RemoteZip] = []
|
||||
for zip_info in all_zips:
|
||||
if not db.is_zip_processed(zip_info.remote_path):
|
||||
if zip_info.remote_path not in processed:
|
||||
new_zips.append(zip_info)
|
||||
if max_results and len(new_zips) >= max_results:
|
||||
log.info("Reached limit of %d", max_results)
|
||||
|
||||
Reference in New Issue
Block a user