Skip to content

Be aware of being online or offline #91

@t-mart

Description

@t-mart

Because Mousehole often runs as a sidecar onto other container's networks, people frequently run into problems when that other container stops and Mousehole is still attached to its network, but it has no VPN/routes/etc.

We should write ephemeral state into Mousehole's backend that keeps track of "being online", which I will define as if the last fetch to MAM threw an exception or not. Example:

// connectivitiy.ts
export let isOnline = true;
// some-handler.ts
try {
  const response = await fetch(endpointUrl, { ... });
  isOnline = true;
  // ... rest of existing logic (parse body, validate schema, return)
} catch (error) {
  isOnline = false;
  throw error;
}

Again, this should be ephemeral state, so we do not need to store it.

After we get this plumbed in, we should surface it in:

  • server logs immediately when it happens
  • the GET /state API endpoint
  • the front end, maybe in a new row? in the status section
  • websocket messages?
  • also, the GET /ok endpoint should incorporate this.

Also, update the error documentation with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions