Skip to content

Automated Chasing

Erik Hetzner edited this page Apr 18, 2018 · 5 revisions

Glossary

Due Date: a date when a particular task is the system is due.

Scheduled Events: automated events which are fired in relation to a Due Date.

Past Events: Scheduled events which is now historical data.

Chasing Events: a sub-type of Scheduled Event

Active Events: the queue of upcoming Scheduled Events a.k.a the list of scheduled events which are yet to be fired.

Scheduled Events Worker: the class which checks the Scheduled Event Queue and determines which Scheduled Events need to run.

Feature description

Event states

(from an email by Sebastian Toomey)

A scheduled reminder can be in two top-level states:

  1. Pending (the date/time it’s scheduled to be sent is in the future)
  2. Processed (the date/time it was scheduled to be sent is in the past)

And then under each of these states:

  1. Pending
    1. On (the default, active state)
    2. Off (it’s been manually deactivated)
  2. Processed
    1. Sent
    2. Unsent (automatically deactivated by the system, e.g. the review was submitted before the scheduled send date)
    3. Unsent (was manually deactivated before the scheduled send date)
    4. Unsent (system error)

Data models

States for an event:

  • Active: Scheduled Events which have not run yet
  • Inactive: Scheduled Events which are turned off either by a user toggling the event off, or when a Due Date is rescheduled to a time which makes the event irrelevant.
  • Processing: Scheduled Events currently being handled by the Scheduled Events Worker
  • Completed: Scheduled Events which have been processed without errors
  • Errored: Scheduled Events which could not be processed due to some system error

Scheduled Events States

Analysis

Execution plan

Epic link: APERTA-5469 - Automated Chasing Open

Here's a general proposal for the sequencing of this epic. This doesn't show all the tickets in the epic, but I think shows the tickets which comprise the epic's backbone.

Step 1: model the due date

Ben has already done most of this. We still need to add some configuration to the due dates ( APERTA-9685 - Review due date period default can be configured at workflow template level Closed ) but that's not a blocker for the subsequent steps

Step 2: model the events relative to the due date

tickets:

APERTA-9692 - User can see events scheduled around a due date on the Reviewer Report card Closed

then

APERTA-9687 - Editing a due date reschedules associated events Closed

Create basic events data model in APERT-9692, in this ticket we only show a UI, so it's the best entry point to create a verifiable (because there's a UI) feature. When creating the model, we should consider the requirements APERT-9687 and APERTA-9688.

Step 3: fire the events

tickets:

APERTA-9688 - Send Reminders for review chasing Closed

and

APERTA-10712 - Create email templates for review reminder emails Closed

We'll do APERTA-9688 which fires off events. Since the events involve sending emails, we'll also need to create those email templates (APERTA-10712)

Extension Plan

When designing the Automated Chasing, we decided to go with a bucket of scheduled events which a worker could work off. This made us lump all scheduled events—past, present, and future—into the same list. To work on this list, we have use scopes which identify parts of the scheduled event which satisfy different criteria at different times.

Through discussions and testing, we have identified a boundary within this list of scheduled events. This boundary demarcates the past events from the active events. Both queues change at different rates. The active events could be rescheduled when a due date is changed. The past events only serve as a historical record of the scheduled events on a particular due-date. Past events don't change very much. This informs a decoupling of Past Events from the normal events. There are some tate changes which come with this too.

This decoupled Past Event now serves as a pure historical. A past event may have one of "completed" or "errored" states. These states woulf not change. They exist as a record of how the event became a "Past Event".

This diagram shows the proposed change to the Scheduled Event (a.k.a active reminders).

Clone this wiki locally