1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 03:27:18 +00:00

Fix syncer not exiting when used on CLI

Fixes #7867
This commit is contained in:
Jeremy Ruston 2023-11-29 09:31:19 +00:00
parent 5dc468f1ea
commit fe17f16675

View File

@ -189,7 +189,7 @@ Syncer.prototype.readTiddlerInfo = function() {
// Record information for known tiddlers // Record information for known tiddlers
var self = this, var self = this,
tiddlers = this.getSyncedTiddlers(); tiddlers = this.getSyncedTiddlers();
this.logger.log("Initialising tiddlerInfo for " + tiddlers.length + " tiddlers"); // this.logger.log("Initialising tiddlerInfo for " + tiddlers.length + " tiddlers");
$tw.utils.each(tiddlers,function(title) { $tw.utils.each(tiddlers,function(title) {
var tiddler = self.wiki.getTiddler(title); var tiddler = self.wiki.getTiddler(title);
if(tiddler) { if(tiddler) {
@ -302,10 +302,16 @@ Syncer.prototype.getStatus = function(callback) {
Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date Synchronise from the server by reading the skinny tiddler list and queuing up loads for any tiddlers that we don't already have up to date
*/ */
Syncer.prototype.syncFromServer = function() { Syncer.prototype.syncFromServer = function() {
this.forceSyncFromServer = true; if(this.canSyncFromServer()) {
this.processTaskQueue(); this.forceSyncFromServer = true;
this.processTaskQueue();
}
}; };
Syncer.prototype.canSyncFromServer = function() {
return !!this.syncadaptor.getUpdatedTiddlers || !!this.syncadaptor.getSkinnyTiddlers;
}
/* /*
Force load a tiddler from the server Force load a tiddler from the server
*/ */
@ -447,7 +453,7 @@ Syncer.prototype.processTaskQueue = function() {
// And trigger a timeout if there is a pending task // And trigger a timeout if there is a pending task
if(task === true) { if(task === true) {
this.triggerTimeout(this.taskTimerInterval); this.triggerTimeout(this.taskTimerInterval);
} else { } else if(this.canSyncFromServer()) {
this.triggerTimeout(this.pollTimerInterval); this.triggerTimeout(this.pollTimerInterval);
} }
} }