Closed
Description
Context
- Operating System: Linux Linux Mint 19.1 Tessa
- Python Version: 3.7.1
- aiogram version: 2.2
- aiohttp version: 3.5.4
Expected Behavior
The user's states will be saved with calling
await dispatcher.storage.close()
await dispatcher.storage.wait_closed()
on shutdown and after the restart will stay the same as before.
Current Behavior
The states are not saved on the disk, the empty object is saved instead.
Failure Information
During the shutdown, the storage makes 2 writing operations on the disk: first one with the correct data and the second with an empty object. The invocation of dispatcher.storage.close() performs these 2 operations.
There is no bug in restoring data: if saving was successful, everything works correctly.
Steps to Reproduce
- Run this gist. The JSONStorage is used there, but the situation with the PickleStorage is the same
- Set your state with
/s1
or/s2
and check if it is set with/g
- Restart the script. An empty object will be saved In your "fsm_data.json" file
- Check that your state has changed after rebooting with
/g