Refactor HistoryManager in aiogram/fsm/scene.py

Removed condition that checked if 'history' is empty before calling 'update_data' in 'Scene'.
This commit is contained in:
andrew000 2023-11-22 00:21:41 +02:00
parent decd5e4ac2
commit dddc884589
No known key found for this signature in database
GPG key ID: D332A306AAA27181

View file

@ -38,10 +38,7 @@ class HistoryManager:
history = history[-self._size :]
loggers.scene.debug("Push state=%s data=%s to history", state, data)
if not history:
await self._history_state.set_data({})
else:
await self._history_state.update_data(history=history)
await self._history_state.update_data(history=history)
async def pop(self) -> Optional[MemoryStorageRecord]:
history_data = await self._history_state.get_data()