Skip to content

JSONStorage and PickleStorage aren't persistent #138

Closed
@Birdi7

Description

@Birdi7

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

  1. Run this gist. The JSONStorage is used there, but the situation with the PickleStorage is the same
  2. Set your state with /s1 or /s2 and check if it is set with /g
  3. Restart the script. An empty object will be saved In your "fsm_data.json" file
  4. Check that your state has changed after rebooting with /g

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is wrong with the framework

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions