Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to SDK v2.0.0-alpha.109 #842

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

env:
SUPPORTED_SDK_VERSIONS: |
v2.0.0-alpha.108
v2.0.0-alpha.109

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SHELL=bash

TOITRUN ?= toit.run

LOCAL_DEV_SDK ?= v2.0.0-alpha.108
LOCAL_DEV_SDK ?= v2.0.0-alpha.109
SETUP_LOCAL_DEV_SERVICE ?= v0.0.1

# If the 'DEV_TOIT_REPO_PATH' variable is set, use the toit.run in its bin
Expand Down
34 changes: 23 additions & 11 deletions src/service/containers.toit
Original file line number Diff line number Diff line change
Expand Up @@ -368,19 +368,31 @@ class ContainerJob extends Job:
"reason": last-trigger-reason_,
"arguments": arguments
}
running_ = containers.start id arguments

// It is unlikely, but possible, that the container stops
// prematurely before we've had the chance to report the job
// as started. We handle this case by delaying the reporting
// of the stopping until we've reported the starting.
pending-on-stopped/Lambda? := null
running_ = containers.start id arguments
--on-event=:: | event-kind/int value |
if event-kind == containers.Container.EVENT-BACKGROUND-STATE-CHANGE:
is-background_ = value
logger_.debug "state changed" --tags={"background": value}
if running_: scheduler_.on-job-updated
--on-stopped=::
mark-stopped := ::
running_ = null
is-triggered_ = false
pin-trigger-manager_.rearm-job this
scheduler_.on-job-stopped this
if running_:
mark-stopped.call
else:
// Register the `mark-stopped` lambda as pending.
pending-on-stopped = mark-stopped
scheduler_.on-job-started this
running_.on-stopped::
running_ = null
is-triggered_ = false
pin-trigger-manager_.rearm-job this
scheduler_.on-job-stopped this
running_.on-event:: | event-kind/int value |
if event-kind == containers.Container.EVENT-BACKGROUND-STATE-CHANGE:
is-background_ = value
logger_.debug "state changed" --tags={"background": value}
scheduler_.on-job-updated
if pending-on-stopped: pending-on-stopped.call

stop -> none:
if not running_: return
Expand Down