SLow down requests for development

This commit is contained in:
Andras Schmelczer 2025-08-16 12:21:41 +01:00
parent 6da107ff3a
commit a2cbcf0519
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 99 additions and 0 deletions

View file

@ -22,6 +22,8 @@ import {
setCursors
} from "./views/cursors/remote-cursors-plugin";
import { LocalCursorUpdateListener } from "./views/cursors/local-cursor-update-listener";
import { slowFetchFactory } from "./debugging/slow-fetch-factory";
import { flakyWebSocketFactory } from "./debugging/flaky-websocket-factory";
const MIN_WAIT_BETWEEN_UPDATES_IN_MS = 250;
export default class VaultLinkPlugin extends Plugin {
@ -41,6 +43,15 @@ export default class VaultLinkPlugin extends Plugin {
".trash/**"
);
const isDebugBuild = process.env.NODE_ENV === "development";
const debugOptions = isDebugBuild
? {
fetch: slowFetchFactory(1),
webSocket: flakyWebSocketFactory(1, new Logger())
}
: {};
this.client = await SyncClient.create({
fs: new ObsidianFileSystemOperations(
this.app.vault,