diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba0430d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ \ No newline at end of file diff --git a/sync_api/__pycache__/main.cpython-312.pyc b/sync_api/__pycache__/main.cpython-312.pyc deleted file mode 100644 index 2a40d5f..0000000 Binary files a/sync_api/__pycache__/main.cpython-312.pyc and /dev/null differ diff --git a/sync_api/models/__pycache__/__init__.cpython-312.pyc b/sync_api/models/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 4ee179e..0000000 Binary files a/sync_api/models/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/sync_api/models/__pycache__/sync_models.cpython-312.pyc b/sync_api/models/__pycache__/sync_models.cpython-312.pyc deleted file mode 100644 index 9a0f20b..0000000 Binary files a/sync_api/models/__pycache__/sync_models.cpython-312.pyc and /dev/null differ diff --git a/sync_api/routers/__pycache__/__init__.cpython-312.pyc b/sync_api/routers/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c51ec95..0000000 Binary files a/sync_api/routers/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/sync_api/routers/__pycache__/health.cpython-312.pyc b/sync_api/routers/__pycache__/health.cpython-312.pyc deleted file mode 100644 index e402067..0000000 Binary files a/sync_api/routers/__pycache__/health.cpython-312.pyc and /dev/null differ diff --git a/sync_api/routers/__pycache__/nodes.cpython-312.pyc b/sync_api/routers/__pycache__/nodes.cpython-312.pyc deleted file mode 100644 index 9ea0f3b..0000000 Binary files a/sync_api/routers/__pycache__/nodes.cpython-312.pyc and /dev/null differ diff --git a/sync_api/routers/nodes.py b/sync_api/routers/nodes.py index 4101b30..3df9740 100644 --- a/sync_api/routers/nodes.py +++ b/sync_api/routers/nodes.py @@ -72,11 +72,18 @@ def determine_sync_status(node_name: str, last_restore_date: Optional[datetime] # Si la última sincronización es más reciente que el archivo if last_restore_date > file_mod_time: return EstadoSincronizacion.ACTUALIZADA.value + + # Si la última restauración fue hace más de 5 horas, continuar + if datetime.now() - last_restore_date > timedelta(hours=5): + # Pasaron más de 5 horas, continuar el proceso + pass + else: + # Aún dentro de las 5 horas → seguir procesando + return EstadoSincronizacion.PROCESANDO.value + except OSError: # Si hay error leyendo el archivo, asumir procesando - pass - - return EstadoSincronizacion.PROCESANDO.value + return EstadoSincronizacion.PROCESANDO.value # Si no existe en ninguna ruta SFTP, usar lógica basada en fechas de restauración if last_restore_date is None: