mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Updated Code snippets (markdown)
parent
3dc60d5163
commit
82a506ea97
1 changed files with 3 additions and 0 deletions
|
@ -613,6 +613,9 @@ if __name__ == '__main__':
|
|||
Version 12 and up includes tools for [making your bot persistent](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Making-your-bot-persistent).
|
||||
|
||||
#### Save and load jobs using pickle
|
||||
|
||||
**WARNING:** This snippet was written for v12.x and can't be used with v13+.
|
||||
|
||||
The following snippet pickles the jobs in the job queue periodically and on bot shutdown, and unpickles and queues them again on startup. Since pickle doesn't support threading primitives, therefore their values and states are extracted (this information may change in the future, always check the `Job` documentation).
|
||||
|
||||
**Note:** `Job` is not yet safe for threads so eventually some special condition may occur. In a previous example, the content of `Job` was modified which resulted in some asynchronous processing errors; now the content of `Job` is extracted without modifying it which is much more safe.
|
||||
|
|
Loading…
Reference in a new issue