This commit is contained in:
michaela.buzalkova
2025-11-17 11:28:31 +01:00
parent a210f801d3
commit ea32ea0bc1
5 changed files with 261 additions and 5 deletions

View File

@@ -107,11 +107,24 @@ cur_meta.execute("""
rows = cur_meta.fetchall()
print(f"📋 Found {len(rows)} attachment records.\n")
# ==============================
# 🧠 MAIN LOOP WITH PROGRESS
# ==============================
# list of unique request_ids in order
unique_request_ids = []
seen = set()
for r in rows:
req_id = r["request_id"]
if req_id not in seen:
unique_request_ids.append(req_id)
seen.add(req_id)
total_requests = len(unique_request_ids)
print(f"🔄 Processing {total_requests} unique requests...\n")
# ==============================
# 🧠 MAIN LOOP
# ==============================
processed_requests = set()
current_index = 0
for r in rows:
req_id = r["request_id"]
@@ -120,11 +133,17 @@ for r in rows:
continue
processed_requests.add(req_id)
current_index += 1
percent = (current_index / total_requests) * 100
print(f"\n[ {percent:5.1f}% ] Processing request {current_index} / {total_requests}{req_id}")
# ========== FETCH ALL VALID FILES FOR THIS REQUEST ==========
cur_meta.execute(
"SELECT filename FROM medevio_downloads WHERE request_id=%s",
(req_id,)
)
valid_files = {sanitize_name(row["filename"]) for row in cur_meta.fetchall()}
# ========== FOLDER NAME BASED ON UPDATEDAT ==========

View File

@@ -12,6 +12,14 @@ Spustí všechny PRAVIDELNÉ skripty v daném pořadí:
5) PRAVIDELNE_5_SaveToFileSystem incremental.py
"""
import time, socket
for _ in range(30):
try:
socket.create_connection(("127.0.0.1", 3307), timeout=3).close()
break
except OSError:
time.sleep(10)
import sys
import subprocess
from pathlib import Path