Reduce Android and iOS background work
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user