Skip to content

Problem: No persistent Quantum State #240

Closed
@maennchen

Description

@maennchen

Description

Currently quantum does not persist any state. Therefore if an application is restarted, all dynamic jobs are lost. Also in the time that has passed since the restart happened no jobs has been executed and there is no way to let them redo the lost time.

Minimal Requirements

I don''t think that Quantum should choose a storage backend and implement it since this heavily depends on the application where it is integrated in. I propose that we just develop protocols for such a storage and let the implementation to the user of the library. (Where this person can decide if he wants to use redis / postgres / mnesia / whatever to ensure persistence)

  • Extendable Storage Protocol
  • Config Option to set a Storage Backend Module
  • Config Option wether to redo not ran jobs between app stop & start

Implementation

I heavily recommend waiting for PR #230 before implementing any changes.

The storage would have to be inserted in two places:

  • JobBroadcaster
    • read on init
      • check if there is a storage present
      • when present read storage instead of config
        • (I see no good way to both read the config and the storage. Since config jobs can be deleted at runtime, there is no safe way to merge storage & config.)
    • write on change
      • after init write config jobs
      • :add
      • :delete
      • :change_state
      • :delete_all
  • ExecutionBroadcaster
    • read on init
      • read last execution date from storage if present and config redo is active
    • write on :execute

PR

Since this is a fairly big implementation, we'd be happy to receive a PR. If this is a popular request please leave a 👍 so that we see that this is important to our users and implement it ourselves.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions