Skip to content

server: ListTasks lists every actor in each atespace it touches #520

Open

Description

@rakyll

Follow-up from #515.

To fill in actor status, listTasks calls substrate.ListActors for each atespace on the page. That call pages through every actor in the atespace, so a 50-task page costs as much as listing all actors there. Every page repeats it. This is the same scale concern as #510.

Substrate has no name filter or batch get, so the likely fix is concurrent per-task GetActor calls. That keeps the cost bounded by the page size.

Activity

  1. yjjnls commented on Nov 19, 2026

    @yjjnls

    Confirmed on current main (af62e9d). listTasks groups the page by atespace and calls substrate.ListActors once per group (internal/server/server.go:538-561). Client.ListActors loops over ListActors pages until next_page_token is empty (internal/substrate/client.go:702), so every page of tasks pays a full actor listing per atespace it touches.

    I have a fix on a fork branch: https://github.com/yjjnls/ax/tree/fix-520 (branch fix-520 in yjjnls/ax, one commit f83288b).

    What it does:

    • Replaces the per-atespace listing with one GetActor per task, the same point read GetTask already uses, including treating NotFound as "actor removed outside AX". The read is factored into taskActor so both paths share the same semantics.
    • Runs the reads concurrently with a bound of 8 in flight. For an atespace with A actors and a page of N tasks, the old path read ceil(A / page_size) actor pages per atespace on the page; the new path reads exactly N actors, none of them twice.
    • A per-task read failure now affects only that task's status, instead of the whole atespace group.

    Tests: TestServer_ListTasksReadsActorPerTask runs the real server against the in-memory Substrate fake. The atespace holds 53 actors while the page holds 3 tasks; the test asserts zero ListActors calls, exactly one GetActor per task, the actor's state for live actors, and the failed state for a task whose actor was removed. I added ListActorsCalls/GetActorCalls counters to the test fake for this. go test ./internal/server/... ./internal/substrate/... ./cmd/... passes, and go test -race ./internal/server/ passes.

    Outside PRs are limited to collaborators in this repository, so could a collaborator open a pull request from yjjnls:fix-520?

    @rakyll — happy to rebase, split, or step aside if you have plans for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions