From 871505f8d23e318fdef314bdd2328401f0ec0009 Mon Sep 17 00:00:00 2001 From: migueldev01 Date: Thu, 18 Jan 2024 11:50:10 -0500 Subject: [PATCH] smeller code --- .../callbacks-controllers/controllers/DeleteController.ts | 5 ++--- src/context/virtual-drive/shared/domain/DelayQueue.ts | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/apps/sync-engine/callbacks-controllers/controllers/DeleteController.ts b/src/apps/sync-engine/callbacks-controllers/controllers/DeleteController.ts index 9881e5c73..defc439df 100644 --- a/src/apps/sync-engine/callbacks-controllers/controllers/DeleteController.ts +++ b/src/apps/sync-engine/callbacks-controllers/controllers/DeleteController.ts @@ -89,9 +89,8 @@ export class DeleteController extends CallbackController { } private CleanQueueFolder(folderUuid: Folder['uuid']) { - const folders = this.foldersQueue.values; - const toReversed = folders.reverse(); - toReversed.forEach((folder) => { + const reversedFolders = this.foldersQueue.reversedValues; + reversedFolders.forEach((folder) => { const isParentFolder = this.folderContainerDetector.run( folder, folderUuid diff --git a/src/context/virtual-drive/shared/domain/DelayQueue.ts b/src/context/virtual-drive/shared/domain/DelayQueue.ts index 19b31f561..63f17a6e8 100644 --- a/src/context/virtual-drive/shared/domain/DelayQueue.ts +++ b/src/context/virtual-drive/shared/domain/DelayQueue.ts @@ -68,6 +68,10 @@ export class DelayQueue { return Array.from(this.queue.keys()); } + get reversedValues(): string[] { + return Array.from(this.queue.keys()).reverse(); + } + get isEmpty(): boolean { return this.queue.size === 0; }