FlowFuse / FlowFuse/flowfuse

Create API endpoint for live project status

Open
#370 1 comment 0 reactions 0 assignees View on GitHub
scope:node-red task
Dominant language
JavaScript
Stars
400
Forks
89
Avg merge
1d 21h
Merged PRs (30d)
146

Description

This is a prerequisite to story #381 - as we need to efficiently return a list of projects *without* getting their individual status from the container driver.

### Description

The current `/projects/:id` endpoint returns the information about a project. This includes the `meta` property that is obtained by http request to the project launcher to get its live status.

This poses a couple problems:

1. if the launcher is not running, that http request takes 3 seconds to time-out - which impacts the overall response time
2. we want an api end point that returns lists of projects - that shouldn't be blocked by having to make those underlying http requests

We need to look again at how the live project status is managed.

From an external API point of view, I propose:

1. Remove the `meta` property from the `/projects/:id` response - so we don't have to make that http request
2. Add a new endpoint `/projects/:id/status` that returns the driver-defined status information.
3. Modify nr-launcher so it reports state changes back to the core app. This will allow the app to cache 'live' status locally (doesn't need to be stored in DB) - and removes the need for the core app to poll the individual projects.

We may want to rename the driver api `details` function to `status` or something similar to align it.

We then need to consider whether we should use a WebSocket based approach to provide live status feedback. There are other uses for that - such as streaming the logs which are currently handled via a polling API (urgh).

### Epic/Story

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.