Investigate deadlock (#178)
This commit is contained in:
parent
564d4a6c37
commit
7a13cb57ce
7 changed files with 85 additions and 17 deletions
|
|
@ -2,10 +2,13 @@ import { choose } from "../utils/choose";
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import { assert } from "../utils/assert";
|
||||
import type { RelativePath, SyncSettings } from "sync-client";
|
||||
import { debugging, Logger, LogLevel } from "sync-client";
|
||||
import { debugging, Logger, LogLevel, utils } from "sync-client";
|
||||
import { MockClient } from "./mock-client";
|
||||
import { sleep } from "../utils/sleep";
|
||||
import type { LogLine } from "sync-client/dist/types/tracing/logger";
|
||||
import type { LogLine } from "sync-client";
|
||||
import { withTimeout } from "../utils/with-timeout";
|
||||
|
||||
const TIMEOUT_MS = 10 * 60 * 1000;
|
||||
|
||||
export class MockAgent extends MockClient {
|
||||
private readonly writtenContents: string[] = [];
|
||||
|
|
@ -134,15 +137,26 @@ export class MockAgent extends MockClient {
|
|||
}
|
||||
|
||||
public async finish(): Promise<void> {
|
||||
await this.client.setSetting("isSyncEnabled", true);
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
await Promise.all(this.pendingActions);
|
||||
await this.client.waitUntilFinished();
|
||||
await withTimeout(
|
||||
(async (): Promise<void> => {
|
||||
await this.client.setSetting("isSyncEnabled", true);
|
||||
await utils.awaitAll(this.pendingActions);
|
||||
await this.client.waitUntilFinished();
|
||||
})(),
|
||||
TIMEOUT_MS,
|
||||
"finish()"
|
||||
);
|
||||
}
|
||||
|
||||
public async destroy(): Promise<void> {
|
||||
await this.client.waitUntilFinished();
|
||||
await this.client.destroy();
|
||||
await withTimeout(
|
||||
(async (): Promise<void> => {
|
||||
await this.client.waitUntilFinished();
|
||||
await this.client.destroy();
|
||||
})(),
|
||||
TIMEOUT_MS,
|
||||
"destroy()"
|
||||
);
|
||||
}
|
||||
|
||||
public assertFileSystemsAreConsistent(otherAgent: MockAgent): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue