Skip to content

Commit 1c3a4b2

Browse files
committed
refactor: reduce instance attributes in migration classes
1 parent b80c1a6 commit 1c3a4b2

2 files changed

Lines changed: 385 additions & 92 deletions

File tree

aredis_om/model/migrations/data/builtin/datetime_migration.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,13 @@ def __init__(
247247
self.failure_mode = failure_mode
248248
self.batch_size = batch_size
249249
self.max_errors = max_errors
250-
self.enable_resume = enable_resume
251250
self.progress_save_interval = progress_save_interval
252251
self.stats = MigrationStats()
253252
self.migration_state = (
254253
MigrationState(self.redis, self.migration_id) if enable_resume else None
255254
)
256255
self.processed_keys_set: Set[str] = set()
257256

258-
# Legacy compatibility
259-
self._processed_keys = 0
260-
self._converted_fields = 0
261-
262257
def _safe_convert_datetime_value(
263258
self, key: str, field_name: str, value: Any
264259
) -> Tuple[Any, bool]:
@@ -332,7 +327,6 @@ async def _load_previous_progress(self) -> bool:
332327

333328
if progress["processed_keys"]:
334329
self.processed_keys_set = set(progress["processed_keys"])
335-
self._processed_keys = len(self.processed_keys_set)
336330

337331
# Restore stats if available
338332
if progress.get("stats"):
@@ -430,7 +424,6 @@ async def _process_hash_key(
430424

431425
self.processed_keys_set.add(key)
432426
self.stats.add_processed_key()
433-
self._processed_keys += 1
434427

435428
self._check_error_threshold()
436429
await self._save_progress_if_needed(model_name, total_keys)
@@ -690,7 +683,6 @@ async def _process_json_model(
690683
# Mark key as processed
691684
self.processed_keys_set.add(key)
692685
self.stats.add_processed_key()
693-
self._processed_keys += 1
694686
processed_count += 1
695687

696688
# Error threshold checking

0 commit comments

Comments
 (0)