fix(sync): clean old JSON files before downloading new orders
Previous sync runs left JSON files in the output directory, causing order_reader to accumulate orders from multiple downloads instead of only processing the latest batch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,13 @@ async def download_orders(
|
||||
out_dir = Path(json_dir)
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Clean old JSON files before downloading new ones
|
||||
old_files = list(out_dir.glob("gomag_orders*.json"))
|
||||
if old_files:
|
||||
for f in old_files:
|
||||
f.unlink()
|
||||
_log(f"Șterse {len(old_files)} fișiere JSON vechi")
|
||||
|
||||
headers = {
|
||||
"Apikey": effective_key,
|
||||
"ApiShop": effective_shop,
|
||||
|
||||
Reference in New Issue
Block a user