ucfopen / Materia

Engage students with easily embedded apps for online courses. Supercharge your course with compelling experiences and game mechanics.
https://ucfopen.github.io/Materia-Docs/
GNU Affero General Public License v3.0
37 stars 32 forks source link

Improve instance lock management #1583

Open clpetersonucf opened 2 months ago

clpetersonucf commented 2 months ago

Instance lock management is a little screwy right now. Currently:

widget_instance_lock in the v1 API will lock an instance for a given user for two minutes. widget_instance_lock is called once when the creator first initializes, but never again. The cache item associated with the lock method persists for two minutes, which means after two minutes the instance is again considered editable. Additionally, the creator will enter a failure state if trying to edit an instance locked by someone else, but it's not graceful - the error dialog is blank and it can be dismissed without reloading or exiting the page.

Two improvements to this feature could include:

  1. Ensure the widget_instance_lock request is performed on a two-minute interval while someone is on the creator page (easiest solution might be to set the query's staleTime to two minutes).
  2. Improve creator failure state when the lock request returns false.