Add throttling for changed tiddlers prefixed with $:/temp/volatile/ (#5458)

new-json-store-area
Nicolas Petton 2021-05-21 09:51:15 +02:00 zatwierdzone przez GitHub
rodzic 05d38054c8
commit 1ddc3ab037
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -82,7 +82,7 @@ exports.startup = function() {
var onlyThrottledTiddlersHaveChanged = true;
for(var title in changes) {
var tiddler = $tw.wiki.getTiddler(title);
if(!tiddler || !(tiddler.hasField("draft.of") || tiddler.hasField("throttle.refresh"))) {
if(!$tw.wiki.isVolatileTiddler(title) && (!tiddler || !(tiddler.hasField("draft.of") || tiddler.hasField("throttle.refresh")))) {
onlyThrottledTiddlersHaveChanged = false;
}
}

Wyświetl plik

@ -221,6 +221,10 @@ exports.isTemporaryTiddler = function(title) {
return title && title.indexOf("$:/temp/") === 0;
};
exports.isVolatileTiddler = function(title) {
return title && title.indexOf("$:/temp/volatile/") === 0;
};
exports.isImageTiddler = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {
@ -1549,4 +1553,3 @@ exports.slugify = function(title,options) {
};
})();

Wyświetl plik

@ -1,5 +1,5 @@
created: 20191013095916159
modified: 20191014093837558
modified: 20210203231820284
tags: RefreshMechanism
title: RefreshThrottling
type: text/vnd.tiddlywiki
@ -11,6 +11,7 @@ The rules governing refresh throttling are:
* When a change notification occurs, throttling will only take place if all of the modified tiddlers meet at least one of these criteria:
** Has the field `draft.of`
** Has the field `throttle.refresh`
** Has a title prefixed with `$:/temp/volatile/`
* If the refresh cycle is to be throttled, a timer is set for the internal specified in [[$:/config/Drafts/TypingTimeout|Hidden Setting: Typing Refresh Delay]] (cancelling any preciously set timer)
** When the timer fires, the refresh cycle is triggered, passing the aggregated titles of all the deferred refresh cycles