mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-25 05:53:00 +00:00
fix: align chunk reads with remote delivery
Consume commonlib's delivery lifecycle, classify finite replication entry points, and document why the five-minute inactivity fuse is only a leak safety valve. Record the remote-activity counter correction and preserve continuous replication's unbounded live channel.
This commit is contained in:
@@ -87,7 +87,7 @@ export function useP2PReplicatorUI(
|
||||
const activeReplicator = replicator.replicator;
|
||||
if (!activeReplicator) return;
|
||||
const settings = host.services.setting.currentSettings();
|
||||
void host.services.replicator.runBoundedRemoteActivity(
|
||||
void host.services.replicator.runFiniteReplicationActivity(
|
||||
() => activeReplicator.openReplication(settings, false, true, false),
|
||||
{ label: "replication" }
|
||||
);
|
||||
|
||||
@@ -12,11 +12,11 @@ vi.mock("@/features/P2PSync/P2PReplicator/P2PServerStatusPaneView", () => ({
|
||||
import { useP2PReplicatorUI } from "./useP2PReplicatorUI";
|
||||
|
||||
describe("useP2PReplicatorUI commands", () => {
|
||||
it("runs a direct modal P2P replication command through the shared activity boundary", async () => {
|
||||
it("exposes a direct modal P2P replication command as finite replication activity", async () => {
|
||||
const commands: Array<{ id: string; checkCallback?: (isChecking: boolean) => unknown }> = [];
|
||||
let initialise: (() => Promise<unknown>) | undefined;
|
||||
const openReplication = vi.fn(async () => true);
|
||||
const runBoundedRemoteActivity = vi.fn(async (task: () => unknown) => await task());
|
||||
const runFiniteReplicationActivity = vi.fn(async (task: () => unknown) => await task());
|
||||
const host = {
|
||||
services: {
|
||||
API: {
|
||||
@@ -35,7 +35,7 @@ describe("useP2PReplicatorUI commands", () => {
|
||||
onLayoutReady: { addHandler: vi.fn() },
|
||||
},
|
||||
setting: { currentSettings: vi.fn(() => ({ remoteType: "COUCHDB" })) },
|
||||
replicator: { runBoundedRemoteActivity },
|
||||
replicator: { runFiniteReplicationActivity },
|
||||
},
|
||||
} as any;
|
||||
const p2p = {
|
||||
@@ -51,7 +51,7 @@ describe("useP2PReplicatorUI commands", () => {
|
||||
commands.find((command) => command.id === "replicate-now-by-p2p")?.checkCallback?.(false);
|
||||
|
||||
await vi.waitFor(() => expect(openReplication).toHaveBeenCalledOnce());
|
||||
expect(runBoundedRemoteActivity).toHaveBeenCalledWith(expect.any(Function), {
|
||||
expect(runFiniteReplicationActivity).toHaveBeenCalledWith(expect.any(Function), {
|
||||
label: "replication",
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user