From 1d6153dff40f9654ca7a0c95e15211094d4f5362 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Mon, 17 Feb 2025 09:41:38 -0500 Subject: [PATCH 1/2] add pseudo-exponential backoff --- src/main/webapp/dataset.xhtml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/dataset.xhtml b/src/main/webapp/dataset.xhtml index b4454b75775..9ade65fc17d 100644 --- a/src/main/webapp/dataset.xhtml +++ b/src/main/webapp/dataset.xhtml @@ -858,6 +858,11 @@ $(this).ready(function () { refreshIfStillLocked(); }); + + var initialInterval = 5000; // 5 seconds + var maxInterval = 300000; // 5 minutes + var currentInterval = initialInterval; + var backoffFactor = 1.2; // Exponential factor function refreshIfStillLocked() { if ($('input[id$="datasetLockedForAnyReasonVariable"]').val() === 'true') { // if dataset is locked, instruct the page to @@ -882,18 +887,22 @@ $('button[id$="refreshButton"]').trigger('click'); //refreshAllCommand(); }, 1500); + } else { + // Reset the interval if the dataset is unlocked + currentInterval = initialInterval; } } } + function waitAndCheckLockAgain() { setTimeout(function () { // refresh the lock in the // backing bean; i.e., check, if the ingest has // already completed in the background: - //$('button[id$="refreshButton"]').trigger('click'); - //refreshLockCommand(); refreshAllLocksCommand(); - }, 10000); + // Increase the interval exponentially for the next check + currentInterval = Math.min((currentInterval * backoffFactor) + 2, maxInterval); + }, currentInterval); } //]]> From a81edf1397cab95098129b3f2f988280e343f258 Mon Sep 17 00:00:00 2001 From: Jim Myers Date: Mon, 17 Feb 2025 09:54:45 -0500 Subject: [PATCH 2/2] release note --- doc/release-notes/11264-slower refresh for long running locks.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/release-notes/11264-slower refresh for long running locks.md diff --git a/doc/release-notes/11264-slower refresh for long running locks.md b/doc/release-notes/11264-slower refresh for long running locks.md new file mode 100644 index 00000000000..96e0cec0ccb --- /dev/null +++ b/doc/release-notes/11264-slower refresh for long running locks.md @@ -0,0 +1 @@ +When a dataset has a long running lock, including when it is 'in review', Dataverse will now slow the page refresh rate over time.