Add concurrency limit to service
This commit is contained in:
parent
5bea3c94c1
commit
eb87de8e68
9 changed files with 116 additions and 58 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import * as lib from "../../../backend/sync_lib/pkg/sync_lib.js";
|
||||
import { Database } from "src/database/database";
|
||||
import { Logger } from "src/logger";
|
||||
import { SyncServer } from "src/services/sync_service";
|
||||
import { SyncService } from "src/services/sync_service";
|
||||
import { hash } from "src/utils/hash";
|
||||
import { unlockDocument, waitForDocumentLock } from "./locks.js";
|
||||
import { FileOperations } from "src/file-operations/file-operations.js";
|
||||
|
|
@ -16,7 +16,7 @@ export async function syncLocallyCreatedFile({
|
|||
filePath,
|
||||
}: {
|
||||
database: Database;
|
||||
syncServer: SyncServer;
|
||||
syncServer: SyncService;
|
||||
operations: FileOperations;
|
||||
updateTime: Date;
|
||||
filePath: RelativePath;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
import { Database } from "src/database/database";
|
||||
import { RelativePath } from "src/database/document-metadata";
|
||||
import { Logger } from "src/logger";
|
||||
import { SyncServer } from "src/services/sync_service";
|
||||
import { SyncService } from "src/services/sync_service";
|
||||
import { unlockDocument, waitForDocumentLock } from "./locks";
|
||||
|
||||
export async function syncLocallyDeletedFile(
|
||||
database: Database,
|
||||
syncServer: SyncServer,
|
||||
relativePath: RelativePath
|
||||
): Promise<void> {
|
||||
export async function syncLocallyDeletedFile({
|
||||
database,
|
||||
syncServer,
|
||||
relativePath,
|
||||
}: {
|
||||
database: Database;
|
||||
syncServer: SyncService;
|
||||
relativePath: RelativePath;
|
||||
}): Promise<void> {
|
||||
await waitForDocumentLock(relativePath);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import * as lib from "../../../backend/sync_lib/pkg/sync_lib.js";
|
||||
import { Database } from "src/database/database";
|
||||
import { Logger } from "src/logger";
|
||||
import { SyncServer } from "src/services/sync_service";
|
||||
import { SyncService } from "src/services/sync_service";
|
||||
import { hash } from "src/utils/hash";
|
||||
import { unlockDocument, waitForDocumentLock } from "./locks.js";
|
||||
import { FileOperations } from "src/file-operations/file-operations.js";
|
||||
|
|
@ -17,7 +17,7 @@ export async function syncLocallyUpdatedFile({
|
|||
oldPath,
|
||||
}: {
|
||||
database: Database;
|
||||
syncServer: SyncServer;
|
||||
syncServer: SyncService;
|
||||
operations: FileOperations;
|
||||
updateTime: Date;
|
||||
filePath: RelativePath;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Database } from "src/database/database";
|
||||
import { unlockDocument, waitForDocumentLock } from "./locks";
|
||||
import { SyncServer } from "src/services/sync_service";
|
||||
import { SyncService } from "src/services/sync_service";
|
||||
import * as lib from "../../../backend/sync_lib/pkg/sync_lib.js";
|
||||
import { hash } from "src/utils/hash";
|
||||
import { Logger } from "src/logger";
|
||||
|
|
@ -14,7 +14,7 @@ export async function syncRemotelyUpdatedFile({
|
|||
remoteVersion,
|
||||
}: {
|
||||
database: Database;
|
||||
syncServer: SyncServer;
|
||||
syncServer: SyncService;
|
||||
operations: FileOperations;
|
||||
remoteVersion: components["schemas"]["DocumentVersionWithoutContent"];
|
||||
}): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue