This commit is contained in:
Andras Schmelczer 2025-03-15 11:44:56 +00:00
parent d799a1da0c
commit 24a8def394
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 7 additions and 3 deletions

View file

@ -301,6 +301,11 @@ export class Database {
);
let newDocument = this.getLatestDocumentByRelativePath(newRelativePath);
if (newDocument !== undefined && !newDocument.isDeleted) {
throw new Error(
`Document already exists at new location: ${newRelativePath}`
);
}
// It's either an invalid state of newDocument is pending deletion and we have
// to wait for it to complete.

View file

@ -1,4 +1,3 @@
import { Syncer } from "../sync-operations/syncer";
import { Settings } from "../persistence/settings";
import { Logger } from "../tracing/logger";
import { createPromise } from "../utils/create-promise";

View file

@ -6,7 +6,7 @@ export function hash(content: Uint8Array): string {
result = (result << 5) - result + content[i];
result |= 0; // Convert to 32bit integer
}
return Math.abs(result).toString(16);
return Math.abs(result).toString(16).padStart(8, "0");
}
export const EMPTY_HASH = hash(new Uint8Array(0));

View file

@ -92,7 +92,7 @@ async function runTest({
async function runTests(): Promise<void> {
const agentCounts = [2, 8];
const jitterScaleInSeconds = [0.5, 0, 2];
const concurrencies = [16, 1];
const concurrencies = [1];
const iterations = [50, 200];
const doDeletes = [true, false];