1
0
mirror of https://github.com/vrtmrz/obsidian-livesync.git synced 2024-12-15 09:14:07 +02:00

Merge pull request #169 from karasevm/feat-timeout

Allow switching CouchDB long polling from heartbeat to timeout
This commit is contained in:
vorotamoroz 2023-02-03 17:41:54 +09:00 committed by GitHub
commit 99594fe517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1279,6 +1279,20 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
text.inputEl.setAttribute("type", "number"); text.inputEl.setAttribute("type", "number");
}); });
new Setting(containerSyncSettingEl)
.setName("Use timeouts instead of heartbeats")
.setDesc("If this option is enabled, PouchDB will hold the connection open for 60 seconds, and if no change arrives in that time, close and reopen the socket, instead of holding it open indefinitely. Useful when a proxy limits request duration but can increase resource usage.")
.addToggle((toggle) => {
toggle
.setValue(this.plugin.settings.useTimeouts)
.onChange(async (value) => {
this.plugin.settings.useTimeouts = value;
await this.plugin.saveSettings();
})
return toggle;
}
);
addScreenElement("30", containerSyncSettingEl); addScreenElement("30", containerSyncSettingEl);
const containerMiscellaneousEl = containerEl.createDiv(); const containerMiscellaneousEl = containerEl.createDiv();
containerMiscellaneousEl.createEl("h3", { text: "Miscellaneous" }); containerMiscellaneousEl.createEl("h3", { text: "Miscellaneous" });