|
10 | 10 |
|
11 | 11 | import logging |
12 | 12 | import time |
13 | | -from datetime import datetime, timezone |
| 13 | +from datetime import datetime |
14 | 14 | from typing import Callable, Optional, Set |
15 | 15 |
|
16 | 16 | import psycopg2 |
@@ -171,14 +171,14 @@ def ensure_cloud_table(self, cloud_conn) -> None: |
171 | 171 | timescaledb.compress_orderby = 'time DESC' |
172 | 172 | ) |
173 | 173 | """) |
174 | | - except Exception: |
175 | | - pass # Extension not available or already set — non-fatal |
| 174 | + except Exception as exc: |
| 175 | + logger.debug("Skipping compression setup for '%s': %s", self.cloud_table, exc) |
176 | 176 | try: |
177 | 177 | cur.execute(""" |
178 | 178 | SELECT add_compression_policy(%s, INTERVAL '2 days', if_not_exists => TRUE) |
179 | 179 | """, (self.cloud_table,)) |
180 | | - except Exception: |
181 | | - pass |
| 180 | + except Exception as exc: |
| 181 | + logger.debug("Skipping compression policy setup for '%s': %s", self.cloud_table, exc) |
182 | 182 | cur.execute( |
183 | 183 | f"CREATE INDEX IF NOT EXISTS {self.cloud_table}_time_idx " |
184 | 184 | f"ON {self.cloud_table} (time DESC)" |
@@ -322,11 +322,11 @@ def sync(self, progress_cb: Optional[Callable[[int, int], None]] = None) -> dict |
322 | 322 | try: |
323 | 323 | local_conn.close() |
324 | 324 | except Exception: |
325 | | - pass |
| 325 | + logger.debug("Ignoring error while closing local DB connection", exc_info=True) |
326 | 326 | try: |
327 | 327 | cloud_conn.close() |
328 | 328 | except Exception: |
329 | | - pass |
| 329 | + logger.debug("Ignoring error while closing cloud DB connection", exc_info=True) |
330 | 330 |
|
331 | 331 | elapsed = time.monotonic() - t0 |
332 | 332 | logger.info(f"Sync complete: {rows_synced} rows in {elapsed:.1f}s ({batches} batches)") |
|
0 commit comments