Dormeto

Docs

Scheduler

Over a day, the idle check reads a workload’s schedule: it wakes it ahead, naps it on time.

2 min read

A Tuesday of the complete schedule: awake from 08:30 to 19:00, a nap window from 20:00 to 07:00.

Tuesday

  1. A visitor’s request inside the nap window gets the waiting page, saying the nap ends at 07:00.
  2. the controllerThe nap window ends. The idle rules apply again: the next request would wake it.
  3. the controllerThe awake window starts: the 08:30 idle check wakes the workload, as Wake now does.
  4. the controllerNobody since 11:50. While the awake window lasts, the idle check never naps it.
  5. The awake window ends. A developer still works: it stays awake under the idle rules.
  6. the controllerThe nap window starts: the 20:00 check naps it, whatever its traffic.
  7. A request gets the waiting page. With the header x-dormeto-wake: 1, it would wake.
A window applies at the idle check of its start, the same on both clouds. The wake’s and the nap’s minutes are an example.

The steps

  1. The idle check reads each workload’s schedule every 5 minutes, before its idle rules.
  2. An awake window’s start wakes an asleep or failed workload, as Wake now does.
  3. While it lasts, the controller never naps the workload on idle.
  4. A nap window’s start naps an awake workload, whatever its traffic.
  5. While it lasts, the waker answers the waiting page with the nap’s end, and wakes nothing.
  6. Outside its windows, the idle rules apply: a nap once idle, a wake at the next request.
  7. Each change of state, the router reports to the manager, with what caused it.
  • A window applies at the idle check of its start, once: Schedules.
  • The schedule is the router’s, in its state: the dashboard, the API and the CLI write it there.

Parts and permissions

Each part calls with its own role, which Roles lists.

ComponentAWSGoogle CloudWhat it does
The idle checkAmazon EventBridge SchedulerEventBridge Scheduler, as the scheduler roleCloud SchedulerCloud Scheduler, as the router’s accountRuns the controller every 5 minutes.
The controllerAWS LambdaLambda, as the controller roleCloud RunCloud Run, as dormetoRouterReads the windows, wakes and naps the workload.
The wakerAWS LambdaLambda, as the waker roleCloud RunCloud Run, as the router’s accountAnswers a nap window’s requests.
The scheduleAmazon DynamoDBDynamoDBFirestoreFirestoreHolds each workload’s windows.
The managerAmazon EventBridgeIts event busAmazon EventBridgeIts event bus, with credentials from its APITakes each change of state (Architecture).

What can go wrong

  • A pause, Wake now or Nap now wins over a window: Schedules.
  • A window that overlaps another of the other kind is refused when saved: Schedules.
  • A nap is held off when an awake window starts within 30 minutes: Schedules.
  • A request with x-dormeto-wake: 1 wakes it in a nap window only with "wake": "header".