From 3852f4cf7046f7907b75df4ba6b9d16891b4985a Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 2 Jan 2025 17:09:10 +0000 Subject: [PATCH] Make sure actions are run instantly if possible --- core/modules/wiki.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 5aaccf77497..df62434fda8 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -177,8 +177,11 @@ exports.runFilteredActions = function() { } var self = this; var now = (new Date()).getTime(); - this.timestampLastRunFilteredActions = this.timestampLastRunFilteredActions || now; - this.intervalFilteredActions = this.intervalFilteredActions || 500; + // Minimum interval between runs + this.intervalFilteredActions = this.intervalFilteredActions || 100; + // Time of the last run + this.timestampLastRunFilteredActions = this.timestampLastRunFilteredActions || now - this.intervalFilteredActions * 2; + // If we've run the filtered actions recently, queue another run if((this.timestampLastRunFilteredActions + this.intervalFilteredActions) > now) { if(!this.filterActionTimerId) { this.filterActionTimerId = setTimeout(function() { @@ -188,7 +191,9 @@ exports.runFilteredActions = function() { } return; } + // Record the time of this run this.timestampLastRunFilteredActions = now; + // Get the list of filtered action tiddlers and process each one var filteredActions = $tw.wiki.getTiddlersWithTag("$:/tags/FilteredActions"); $tw.utils.each(filteredActions,function(filteredActionTitle) { var tiddler = self.getTiddler(filteredActionTitle);