Allow-list error type
This commit is contained in:
parent
056fb96ce8
commit
387e7afd58
3 changed files with 35 additions and 20 deletions
2
.github/workflows/publish-plugin.yml
vendored
2
.github/workflows/publish-plugin.yml
vendored
|
|
@ -3,7 +3,7 @@ name: Publish Obsidian plugin
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ["*"]
|
tags: ["*"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,11 @@ export class MockAgent extends MockClient {
|
||||||
this.createFileAction.bind(this)
|
this.createFileAction.bind(this)
|
||||||
];
|
];
|
||||||
|
|
||||||
if (this.client.getSettings().isSyncEnabled) {
|
if (
|
||||||
if (this.doNotTouchWhileOffline.length === 0) {
|
this.client.getSettings().isSyncEnabled &&
|
||||||
|
this.doNotTouchWhileOffline.length === 0
|
||||||
|
) {
|
||||||
options.push(this.disableSyncAction.bind(this));
|
options.push(this.disableSyncAction.bind(this));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
options.push(this.enableSyncAction.bind(this));
|
options.push(this.enableSyncAction.bind(this));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,15 @@ const TEST_ITERATIONS = 5;
|
||||||
// Simulate async file access by injecting waiting time before returning from file operations.
|
// Simulate async file access by injecting waiting time before returning from file operations.
|
||||||
let slowFileEvents = false;
|
let slowFileEvents = false;
|
||||||
|
|
||||||
|
// Whether to do resets in the test runs
|
||||||
|
let doResets = false;
|
||||||
|
|
||||||
async function runTest({
|
async function runTest({
|
||||||
agentCount,
|
agentCount,
|
||||||
concurrency,
|
concurrency,
|
||||||
iterations,
|
iterations,
|
||||||
doDeletes,
|
doDeletes,
|
||||||
doResets,
|
useResets,
|
||||||
useSlowFileEvents,
|
useSlowFileEvents,
|
||||||
jitterScaleInSeconds
|
jitterScaleInSeconds
|
||||||
}: {
|
}: {
|
||||||
|
|
@ -23,13 +26,14 @@ async function runTest({
|
||||||
concurrency: number;
|
concurrency: number;
|
||||||
iterations: number;
|
iterations: number;
|
||||||
doDeletes: boolean;
|
doDeletes: boolean;
|
||||||
doResets: boolean;
|
useResets: boolean;
|
||||||
useSlowFileEvents: boolean;
|
useSlowFileEvents: boolean;
|
||||||
jitterScaleInSeconds: number;
|
jitterScaleInSeconds: number;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
slowFileEvents = useSlowFileEvents;
|
slowFileEvents = useSlowFileEvents;
|
||||||
|
doResets = useResets;
|
||||||
|
|
||||||
const settings = `with ${agentCount} agents, concurrency ${concurrency}, iterations ${iterations}, doDeletes ${doDeletes}, doResets ${doResets}, jitterScaleInSeconds ${jitterScaleInSeconds}, useSlowFileEvents ${useSlowFileEvents}`;
|
const settings = `with ${agentCount} agents, concurrency ${concurrency}, iterations ${iterations}, doDeletes ${doDeletes}, doResets ${useResets}, jitterScaleInSeconds ${jitterScaleInSeconds}, useSlowFileEvents ${useSlowFileEvents}`;
|
||||||
console.info(`Running test ${settings}`);
|
console.info(`Running test ${settings}`);
|
||||||
|
|
||||||
const vaultName = uuidv4();
|
const vaultName = uuidv4();
|
||||||
|
|
@ -49,7 +53,7 @@ async function runTest({
|
||||||
initialSettings,
|
initialSettings,
|
||||||
`agent-${i}`,
|
`agent-${i}`,
|
||||||
doDeletes,
|
doDeletes,
|
||||||
doResets,
|
useResets,
|
||||||
useSlowFileEvents,
|
useSlowFileEvents,
|
||||||
jitterScaleInSeconds
|
jitterScaleInSeconds
|
||||||
)
|
)
|
||||||
|
|
@ -118,6 +122,16 @@ async function runTest({
|
||||||
|
|
||||||
async function runTests(): Promise<void> {
|
async function runTests(): Promise<void> {
|
||||||
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
for (let i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
|
await runTest({
|
||||||
|
agentCount: 2,
|
||||||
|
concurrency: 16,
|
||||||
|
iterations: 100,
|
||||||
|
doDeletes: true,
|
||||||
|
useResets: true,
|
||||||
|
useSlowFileEvents: true,
|
||||||
|
jitterScaleInSeconds: 0.75
|
||||||
|
});
|
||||||
|
|
||||||
for (const useSlowFileEvents of [true, false]) {
|
for (const useSlowFileEvents of [true, false]) {
|
||||||
for (const concurrency of [
|
for (const concurrency of [
|
||||||
16,
|
16,
|
||||||
|
|
@ -129,23 +143,13 @@ async function runTests(): Promise<void> {
|
||||||
concurrency,
|
concurrency,
|
||||||
iterations: 100,
|
iterations: 100,
|
||||||
doDeletes,
|
doDeletes,
|
||||||
doResets: false,
|
useResets: false,
|
||||||
useSlowFileEvents,
|
useSlowFileEvents,
|
||||||
jitterScaleInSeconds: 0.75
|
jitterScaleInSeconds: 0.75
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await runTest({
|
|
||||||
agentCount: 2,
|
|
||||||
concurrency: 16,
|
|
||||||
iterations: 100,
|
|
||||||
doDeletes: true,
|
|
||||||
doResets: true,
|
|
||||||
useSlowFileEvents: true,
|
|
||||||
jitterScaleInSeconds: 0.75
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,6 +181,16 @@ process.on("unhandledRejection", (error, _promise) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
doResets &&
|
||||||
|
error instanceof Error &&
|
||||||
|
error.message.includes(
|
||||||
|
"SyncClient has been destroyed and can no longer be used"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.error("Unhandled rejection:", error);
|
console.error("Unhandled rejection:", error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue