learnweb / moodle-mod_collabora

:memo: :globe_with_meridians: An activity for live document editing in Moodle, powered by Collabora Online
GNU General Public License v3.0
8 stars 8 forks source link

Handle server unavailability better #25

Open Ashod opened 3 years ago

Ashod commented 3 years ago

This prevents xml parsing errors when the server is not avialable. In a follow-up patch we will throw a 'server unavailable' error to better communicate the issue.

Ashod commented 3 years ago

@moodlebeuth, @grabs, if you can take a look at this tiny improvement, would be great.

After we merge #20 I will throw an error with the server name stating that it's currently unavailable. But for now, at least we don't show XML errors, which are unhelpful.

codecov-commenter commented 3 years ago

Codecov Report

Merging #25 into master will decrease coverage by 0.55%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #25      +/-   ##
============================================
- Coverage     14.02%   13.46%   -0.56%     
- Complexity      137      144       +7     
============================================
  Files            17       17              
  Lines           699      728      +29     
============================================
  Hits             98       98              
- Misses          601      630      +29     
Impacted Files Coverage Δ Complexity Δ
moodle/mod/collabora/classes/collabora.php 32.57% <0.00%> (-4.93%) 66.00% <0.00%> (+7.00%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc22536...c243323. Read the comment docs.

codecov-io commented 3 years ago

Codecov Report

Merging #25 into master will decrease coverage by 0.55%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #25      +/-   ##
============================================
- Coverage     14.02%   13.46%   -0.56%     
- Complexity      137      144       +7     
============================================
  Files            17       17              
  Lines           699      728      +29     
============================================
  Hits             98       98              
- Misses          601      630      +29     
Impacted Files Coverage Δ Complexity Δ
moodle/mod/collabora/classes/collabora.php 32.57% <0.00%> (-4.93%) 66.00% <0.00%> (+7.00%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc22536...c243323. Read the comment docs.

grabs commented 3 years ago

Hi Ashod,

sorry for the long delay. Thank you for this request! I looked into it but unfortunately I couldn't get it work as expected :(. The problem here is that the plugin uses the moodle cache to get the discovery_xml which you try to check. So if the plugin has established the connection once the xml always is loaded from cache until the cache is purged. I don't know whether or not the cache is needed. On my dev system the discovery xml is loaded in nearly no time. For me there are to possible ways to go with this: 1) You don't use the cache and load the discovery xml each time a user opens a document 2) You only check the base url and check for an "ok" in it. This should be sufficient too. What do you think?

Best regards Andreas