mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-05 15:58:19 +00:00
Cancel stale conflict resolutions when queueing checks
This commit is contained in:
1 parent
17d1e3f50a
commit
8844a88399
4 files changed
+108
-3
No files matched your search
@@ -54,6 +54,7 @@ export interface ConflictResolutionOperationsDependencies {
|
||||
}
|
||||
|
||||
export interface ConflictResolutionOperations {
|
||||
readonly cancelActiveResolution: (filename: FilePathWithPrefix) => void;
|
||||
readonly resolveByDeletingRevision: (
|
||||
path: FilePathWithPrefix,
|
||||
deleteRevision: string,
|
||||
@@ -72,6 +73,13 @@ export function createConflictResolutionOperations(
|
||||
const latestResolveRequestByFilename = new Map<FilePathWithPrefix, number>();
|
||||
let nextResolveRequestId = 0;
|
||||
|
||||
const cancelActiveResolution = (filename: FilePathWithPrefix): void => {
|
||||
latestResolveRequestByFilename.delete(filename);
|
||||
if (isLockAcquired(`conflict-resolve:${filename}`)) {
|
||||
dependencies.events.emitEvent(EVENT_CONFLICT_CANCELLED, filename);
|
||||
}
|
||||
};
|
||||
|
||||
const resolveByDeletingRevision = async (
|
||||
path: FilePathWithPrefix,
|
||||
deleteRevision: string,
|
||||
@@ -299,6 +307,7 @@ export function createConflictResolutionOperations(
|
||||
};
|
||||
|
||||
return {
|
||||
cancelActiveResolution,
|
||||
resolveByDeletingRevision,
|
||||
checkConflictAndPerformAutoMerge,
|
||||
resolve,
|
||||
|
||||
Reference in new issue
Block a user