NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
42 stars 26 forks source link

Call to metrics service fails sometimes #805

Closed laurenwalker closed 5 years ago

laurenwalker commented 5 years ago

Sometimes the call to the metrics service on the MetadataView fails due to a time out error.

screen shot 2018-10-15 at 6 15 15 pm

Example dataset where this happened at least twice: https://knb.ecoinformatics.org/view/urn:uuid:0beca8b9-7fcb-468f-9118-2bcc9f641f90

There are two issues here:

  1. Why is the request failing
  2. When it fails, the metric count pill on the buttons keep spinning. When a call to the metric service fails, we should remove the spinner from the button and replace with some kind of error icon. (Maybe a question mark) and the tooltip should say that the count could not be retrieved at this time.
screen shot 2018-10-15 at 6 19 54 pm
rushirajnenuji commented 5 years ago

Hey @laurenwalker - thanks for writing up this issue.

So, regarding 1 - Dave, Chris and I looked into the error and turns out there was some issue with the Multi-processing implementation of the same. We eventually ended up deciding to keep the processing serial for now, till we come up with a better solution.

With serial processing on the back-end, the XHR request might take a while to load the metrics. So, in this commit, I've extended the XHR request timeout to the metrics service to 50s.

Regarding 2 - yes, the icon-spinner keeps on spinning when the call fails which is wrong. So, I made a few changes in the above commit. Here's what the UI looks like -

screen shot 2018-10-16 at 9 44 06 am

I have a small doubt regarding the implementation:

In the MetricView, I have -

            ...

            // waiting for the fetch() call to succeed.
            this.listenTo(this.model, "sync", this.renderResults);

            // in case when there is an error for the fetch call.
            this.listenTo(this.model, "error", this.renderError);

Do we have to make sure that the MetricView stops listening for sync event of the MetricsModel in case of the error event?

laurenwalker commented 5 years ago

Thanks Rushi! Some thoughts:

rushirajnenuji commented 5 years ago

Hey Lauren - I appreciate you taking time and penning down these suggestions.

I'll go ahead and start working on these changes. Thanks again!

rushirajnenuji commented 5 years ago

Reference commit: https://github.com/NCEAS/metacatui/commit/684c273a7ef7543cfe01e40b25c2f53a81a8dc11

Disabled the icons on metrics-service failure:

screen shot 2018-10-22 at 9 12 23 am