Could we reduce the frequency of autosave?

My tiddlywiki is configured with note.js in local window machine. The autosave feature is enabled to save changes in draft. The tiddlywiki folder also sync by onedrive and syncthing.

It seems the autosave is triggered when a change detected, then trigger sync by onedrive and syncthing. Could we reduce the frequency of autosave? For example, every 10s if there is a change.

1 Like

As I understand it, If you are using node.JS it will save tiddlers independently and as they change.

  • Have you tried turning off autosave to see if in fact it no longer occurs?
  • Could you change the settings in sync by onedrive and syncthing?

There is a Timed save method as part of Erics Timer tools It's About Time! — TiddlyTools: "Small Tools for Big Ideas!" (tm)

Thanks for quick reply
I can confirm node.js will trigger to save when changes are detected, no matter the autosave option is enabled.

I don’t think I can change any configuration in one drive as it is managed by our IT.

Will test the time plugins.

I doubt the timers will help you, as I suspected the node version is about tiddler level saving, not wiki level saving.

Do you make use of the One drive folders that are synchronised? When using node it is a server, so the idea of having two servers running on the same or a copy of server files can be a problem.

Can you tell use the big picture, how you use your wikis, only on your computer?, how you use the Dropbox files etc…

  • Also depending on how IT manages the One Drive there may be ways to keep things out of it, or to do a local customisation.

I use TW in three devices, i.e. local laptop, remote VM, mobile.

  • Three devices are configured with node.js and sync with syncthing.
  • The local laptop is also sync with one drive. Onedrive is used to sync file to online for backup.
  • Local laptop and remote VM is real time synced by syncthing. Mobile is only synced when I need to read or make changes on mobile.

Syncthing and onedrive are trigged to sync during my types as changes are detected.

It is not a big issue for me as everything is working now. Just think it would be better if I could reduce autosave frequency, especially at slow internet (e.g. working at home).

I understand the alternative method is to move tiddlywiki folder out of one drive or disable onedrive/syncthing when I don’t need it.

PS: We only allow to use onedrive and cannot change any configuration.

If you installed syncthing this perhaps you can at least schedule this sync to less often. But the longer the gap the longer you have to wait before shutting down and moving to another device.

  • Yes, when the business provides One Drive they are often trying to protect users from file loss.

I just use one device at a time. It should be not a big issue if syncthing is reduced frequency.

Specifically, what “Saver” plugins are you using. There is a difference internally for “Save” method and “Sync” method.

  • Sync method syncs all changes to the tiddler store (excluding certain titles) to the Node.js server, which then adds that new tiddler to its tiddler store, which triggers a sync-to-disk API. This is handled by plugins/tiddlyweb and plugins/filesystem.
  • Save method re-builds the HTML-wiki file, and saves THAT to a server or storage somewhere. Various plugins.

The timing for each can be controlled, but config is separated by namespace.

2 Likes

Thanks for the tips. I use node.js to save files. How should I config the timing?

This is unfortunately a case where the best documentation is the javascript code tiddler itself (not that intuitive, but start reading the core “shadow” tiddlers for the things you are interested in).

If we go to Sidebar> More> Shadow Tiddlers> $:/core/modules/syncer.js, we can see a bunch of tiddler titles that control config settings.

/*\
title: $:/core/modules/syncer.js
type: application/javascript
module-type: global

The syncer tracks changes to the store and synchronises them to a remote data store represented as a "sync adaptor"

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Defaults
*/
Syncer.prototype.titleIsLoggedIn = "$:/status/IsLoggedIn";
Syncer.prototype.titleIsAnonymous = "$:/status/IsAnonymous";
Syncer.prototype.titleIsReadOnly = "$:/status/IsReadOnly";
Syncer.prototype.titleUserName = "$:/status/UserName";
Syncer.prototype.titleSyncFilter = "$:/config/SyncFilter";
Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
Syncer.prototype.titleSyncThrottleInterval = "$:/config/SyncThrottleInterval";
Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer
Syncer.prototype.throttleInterval = 1 * 1000; // Defer saving tiddlers if they've changed in the last 1s...
Syncer.prototype.errorRetryInterval = 5 * 1000; // Interval to retry after an error
Syncer.prototype.fallbackInterval = 10 * 1000; // Unless the task is older than 10s
Syncer.prototype.pollTimerInterval = 60 * 1000; // Interval for polling for changes from the adaptor

/*
Instantiate the syncer with the following options:
syncadaptor: reference to syncadaptor to be used
wiki: wiki to be synced
*/
function Syncer(options) {
var self = this;
	this.wiki = options.wiki;
	// Save parameters
	this.syncadaptor = options.syncadaptor;
	this.disableUI = !!options.disableUI;
	this.titleIsLoggedIn = options.titleIsLoggedIn || this.titleIsLoggedIn;
	this.titleUserName = options.titleUserName || this.titleUserName;
	this.titleSyncFilter = options.titleSyncFilter || this.titleSyncFilter;
	this.titleSavedNotification = options.titleSavedNotification || this.titleSavedNotification;
	this.taskTimerInterval = options.taskTimerInterval || this.taskTimerInterval;
	this.throttleInterval = options.throttleInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncThrottleInterval,""),10) || this.throttleInterval;
	this.errorRetryInterval = options.errorRetryInterval || this.errorRetryInterval;
	this.fallbackInterval = options.fallbackInterval || this.fallbackInterval;
	this.pollTimerInterval = options.pollTimerInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncPollingInterval,""),10) || this.pollTimerInterval;
	this.logging = "logging" in options ? options.logging : true;
	// Make a logger

The important ones being:
Syncer.prototype.titleSyncThrottleInterval = “$:/config/SyncThrottleInterval”;
Syncer.prototype.taskTimerInterval = 1 * 1000; // Interval for sync timer
…
this.throttleInterval = options.throttleInterval || parseInt(this.wiki.getTiddlerText(this.titleSyncThrottleInterval,""),10) || this.throttleInterval;
this.errorRetryInterval = options.errorRetryInterval || this.errorRetryInterval;

These are miliseconds, so the tiddler value sould be as well.

So, to change it, we set the text field of $:/config/SyncThrottleInterval to say 30000 for once every 30 seconds. This affects both browser → server, AND server → filesystem syncing.

:dark_sunglasses:

Cool this is what I need