commanded-scheduler icon indicating copy to clipboard operation
commanded-scheduler copied to clipboard

Rescheduling commands

Open gornik opened this issue 6 years ago • 3 comments

It is currently not possible to schedule a command using schedule_uuid that was previously cancelled:

iex> Scheduler.schedule_once(seat_id, %TimeoutSeatReservation{...}, ~N[2020-01-01 12:00:00])
:ok
iex> Scheduler.cancel_schedule(seat_id)
:ok
iex> Scheduler.schedule_once(seat_id, %TimeoutSeatReservation{...}, ~N[2020-01-01 14:00:00])
{:error, :already_scheduled}

This is because command handlers for scheduling are allowed only when the schedule aggregate instance does not exist yet:

  def execute(%Schedule{schedule_uuid: nil} = schedule, %ScheduleOnce{} = once) do
    ...
  end

  def execute(%Schedule{}, %ScheduleOnce{}), do: {:error, :already_scheduled}

https://github.com/commanded/commanded-scheduler/blob/master/lib/commanded/scheduler/schedule/schedule.ex#L27

This means that if we need rescheduling, we need to generate a new random schedule_uuid for each new schedule and track it client side. This makes it a bit more difficult and doesn't guarantee schedule uniqueness (in the example above that we have a single active schedule per single seat), e.g.:

iex> Scheduler.schedule_once(seat_id, %TimeoutSeatReservation{...}, ~N[2020-01-01 12:00:00])
:ok
iex> Scheduler.cancel_schedule(seat_id)
:ok
iex> Scheduler.schedule_once(seat_id, %TimeoutSeatReservation{...}, ~N[2020-01-01 14:00:00])
:ok
iex> Scheduler.schedule_once(seat_id, %TimeoutSeatReservation{...}, ~N[2020-01-01 16:00:00])
{:error, :already_scheduled}

I believe it might also be useful to have some kind of rescheduling of a command, something like:

Scheduler.reschedule(seat_id, ~N[2020-01-01 14:00:00])

gornik avatar Jul 19 '19 14:07 gornik

@TheodoreGC Perhaps the documentation isn't clear, but eve-k3s built from pkg/k3s is an application which can be uploaded and deployed on top of EVE, and Eden needs the eve image to deploy on the device. That image is built using 'make eve' which produces a tag.

But do you have any modifications to EVE? If not you can just run Eden with the default EVE version without specifying a tag.

eriknordmark avatar Mar 31 '21 15:03 eriknordmark