webknossos icon indicating copy to clipboard operation
webknossos copied to clipboard

Remove await from AnnotationUploadService

Open frcroth opened this issue 1 year ago • 1 comments

With #7437 NMLParser/parse returns a Fox, which is handled with await. This await should be removed.

The Fox return value is necessitated by a request to the datastore to check if a segment index file exists (which will then set hasSegmentIndex in the annoation).

Possible solutions:

  • Propagate the Fox through the NMLResult types
  • Call parse with the result of the datastore request (may be difficult because the necessary properties may not be known at that point)

frcroth avatar Jan 15 '24 13:01 frcroth

I think the perfect place for this asynchronous lookup would be in adaptPropertiesToFallbackLayer in AnnotationIOController. We should add comments to the NmlParser that bbox, elementClass and hasSegmentIndex will be adapted to the fallback layer’s in post-processing.

While adaptPropertiesToFallbackLayer is also currently not asynchronous, I think it would be way less pain to change that, compared to the NMLParser itself.

We should probably also add some small caching (though with fast timeout) so that if thousands of NMLs are uploaded (this sometimes happens during task creation), not thousands of requests are sent to the datastore to look up this information for the same segmentation layer over and over again.

fm3 avatar Jan 27 '24 09:01 fm3