From 972d208af4e811efa70edcb35c7a5c3bdf97faf7 Mon Sep 17 00:00:00 2001 From: Maksim Karasev Date: Thu, 2 Feb 2023 02:17:44 +0300 Subject: [PATCH] Expose useTimeouts option in the settings tab --- src/ObsidianLiveSyncSettingTab.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ObsidianLiveSyncSettingTab.ts b/src/ObsidianLiveSyncSettingTab.ts index 770a2f6..a30514e 100644 --- a/src/ObsidianLiveSyncSettingTab.ts +++ b/src/ObsidianLiveSyncSettingTab.ts @@ -1279,6 +1279,20 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab { 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); const containerMiscellaneousEl = containerEl.createDiv(); containerMiscellaneousEl.createEl("h3", { text: "Miscellaneous" });