Reduce Android and iOS background work

This commit is contained in:
shen
2026-12-03 16:46:29 -08:00
parent 9e05f1ad93
commit e68cb6c909
12 changed files with 189 additions and 60 deletions
@@ -91,6 +91,8 @@ func dispatch(id uint64, data []byte) (any, error) {
if err := slot.engine.Stop(); err != nil {
return nil, err
}
case "health":
return map[string]string{"state": slot.engine.State()}, nil
case "status":
default:
return nil, errors.New("unknown engine operation")
@@ -27,6 +27,13 @@ func TestABIRequestLifecycle(t *testing.T) {
if _, err := dispatch(id, input); err != nil {
t.Fatal(err)
}
health, err := dispatch(id, []byte(`{"op":"health"}`))
if err != nil {
t.Fatal(err)
}
if state, ok := health.(map[string]string); !ok || len(state) != 1 || state["state"] != "Running" {
t.Fatalf("unexpected health payload: %#v", health)
}
if _, err := dispatch(id, input); err == nil {
t.Fatal("duplicate start accepted")
}