Skip to content

component_failed: a component reports a failure after it has started #19

Description

@cressie176

Context

Steve, 2026-09-27: a network component can fail after it has started (a postgres client emits an error). Passing the system into the component so it can call stop() is clumsy and gives it too much power. The system should be told, and the application should decide.

Behaviour

  • A start function receives (components, { signal, fail }). Breaking change to the second argument; released as 0.2.0.
  • fail(error) while the component's own start is in flight deems that start failed, exactly as its own timeout does: component_start_failed carries the error, the rest are skipped as failure, the system stops, start() rejects.
  • fail(error) after the component started but while start() is still in flight announces component_failed with { name, error }, then fails the start with that error: the unreached are skipped as failure, the started (the failed component included) are stopped, start() rejects with the error.
  • fail(error) once start() has resolved announces component_failed and nothing else. The application restarts, stops or ignores.
  • fail after the component has stopped is ignored. fail twice announces twice. exitOn does not react.

Not covered

A component which does not notice the error and completes its start after being deemed failed has its stop skipped, as a timed-out one does today.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions