kuzudb / explorer

Browser-based user interface for Kùzu graph database
https://hub.docker.com/r/kuzudb/explorer
MIT License
29 stars 5 forks source link

Implemented query progress #152

Closed MSebanc closed 1 month ago

mewim commented 1 month ago

I just realized that there might be an implicit race condition in this: When the query is completed:

  1. The backend will unset the uuid from queryMap.
  2. The backend will return the progress to frontend.
  3. The frontend will unset the setInterval function to stop polling after receiving the query result.

However, if a polling occurs between 2 and 3, there is a chance that the frontend receives a data object of undefined due to that the uuid has already been erased in step 1, causing a failure in handling the result.

I propose that the backend returns status 404 instead of sending undefined to frontend when the uuid does not exist in the map. Then, for Axios.get(/api/cypher/result/${this.cellId}), an error handler can be added to handle the 404. In case of error, it can simply ignore without doing anything.