biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
13 stars 15 forks source link

Debounce modify annotation requests #918

Open mzur opened 2 months ago

mzur commented 2 months ago

For each modification of an annotation, a request is sent to the backend which in turn triggers a ProcessAnnotatedImage/Video job to reprocess the annotation. Modifications can happen in quick succession, e.g. if a polygon is adjusted or if the brush/eraser/fill tools are used.

To reduce the number of requests sent, use the debounce() function to delay sending requests until no modification happened for 5 s. All requests for modifications within this 5 s window are not sent.

One possible problem with this could be that the user closes the window/tab while the 5 s timeout is still running. Then all modifications are not saved. We could add an unload event listener that always fires and asks the user to wait when there are unfinished timeouts captured by the debounce() function.