Skip to content

[FEATURE] Persistence inside of Jobs #1671

@cupcakearmy

Description

@cupcakearmy

The job runner are amazing. But they lack some documentation in terms of persistence. For me it turned out to do something along the lines of this:

persistence = PicklePersistence(DB_FILE)
updater: Updater = Updater('token', use_context=True, persistence=persistence)

def update_updater_data():
    updater.dispatcher.user_data = persistence.user_data
    updater.dispatcher.update_persistence()
    persistence.flush()

def my_job():
    persistence.user_data......do stuff and save it
    update_updater_data()

which works, but took me a lot of trial and error.
Is there a better approach to this? (maybe I'm missing something)
It might be a good idea to add a little section either in the persistence or jobqueue wiki site :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions