Bibo-Joshi · GitHub

Another comment on this.

This PR does not ensure that the classes Job and JobQueue itself can be easily persisted/pickled. This is because

  • The ext.Job instance has a reference to the aps.Job instance and this cycling reference can be a problem
  • The JobQueue has a reference to the APS Scheduler and a weak reference to the Application both of which are surely not easy to persist

IMO making ext.{Job, JobQueue} pickable out ouf the box is a non-goal of this PR. Serializing a APS Job will still be possible with reasonable effort with the following two considerations:

  • the first argument of the APS Job callback will be the JobQueue. By storing a reference to that in the JobStore itself, it will be straight forward to re-insert that on deserializing the APS Job
  • the second argument of the APS Job callback will be the ext.Job. Instead of serializing that, one can instead serialize the attributes (callback, chat_id, …)

Read the original on github.com ↗