Skip to content

PicklePersistence of user_data set within conversations #1297

@Bibo-Joshi

Description

@Bibo-Joshi

Steps to reproduce

  1. In persistentconversationbot.py, change persistent=True to persistent=False

  2. Start the bot, give the bot some information to store

  3. Stop bot

  4. Start bot again, send command /show_data. It will be empty

Expected behaviour

user_data changed within a conversation should be persisted even if the conversation is not
(i.e., I would expect this)

Actual behaviour

user_data changed within a conversation that is not persisted, will not be persisted

Configuration

Raspbian GNU/Linux 9 (stretch)

Version of Python, python-telegram-bot & dependencies:

python-telegram-bot 11.1.0
certifi 2018.01.18
future 0.17.1
Python 3.5.3 (default, Sep 27 2018, 17:25:39)  [GCC 6.3.0 20170516]

Research so far:

  1. When the conversation is persisted, the user_data will only be persisted, if single_file = True. This is because this will trigger dump_singlefile() in picklepersistence.py on update in Conversation. When setting single_file = False, user_data will not be persisted

  2. Things go south in update_user_data(). Printing the result of

    self.user_data.get(user_id) == data:
    

    always gives True even though self.user_data.[user_id] has changed after user input (as one can test by printing it).

I therefore conclude, that self.user_data[user_id] must be changed somewhere along the way before update_user_data() is called. Still, I can't pinpoint, where that happens. Will try and find it.

If you have a clue, please let me know :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions