From dc4b055eaa233fcd65ec41f801aa84630423f206 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 2 Jun 2024 17:15:29 +0200 Subject: [PATCH] Remove unused database compacting IPC channel --- src/constants.js | 3 +-- src/datastores/handlers/base.js | 24 ++++-------------------- src/datastores/handlers/electron.js | 14 -------------- src/datastores/handlers/web.js | 8 -------- src/main/index.js | 8 -------- 5 files changed, 5 insertions(+), 52 deletions(-) diff --git a/src/constants.js b/src/constants.js index 8eb0089b512e8..c3c3e164edc5e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -37,8 +37,7 @@ const DBActions = { UPSERT: 'db-action-upsert', DELETE: 'db-action-delete', DELETE_MULTIPLE: 'db-action-delete-multiple', - DELETE_ALL: 'db-action-delete-all', - PERSIST: 'db-action-persist' + DELETE_ALL: 'db-action-delete-all' }, HISTORY: { diff --git a/src/datastores/handlers/base.js b/src/datastores/handlers/base.js index 7c2eb4ec0539d..b630327899ee1 100644 --- a/src/datastores/handlers/base.js +++ b/src/datastores/handlers/base.js @@ -9,10 +9,6 @@ class Settings { return db.settings.updateAsync({ _id }, { _id, value }, { upsert: true }) } - static persist() { - return db.settings.compactDatafileAsync() - } - // ******************** // // Unique Electron main process handlers static _findAppReadyRelatedSettings() { @@ -75,10 +71,6 @@ class History { static deleteAll() { return db.history.removeAsync({}, { multi: true }) } - - static persist() { - return db.history.compactDatafileAsync() - } } class Profiles { @@ -97,10 +89,6 @@ class Profiles { static delete(id) { return db.profiles.removeAsync({ _id: id }) } - - static persist() { - return db.profiles.compactDatafileAsync() - } } class Playlists { @@ -177,18 +165,14 @@ class Playlists { static deleteAll() { return db.playlists.removeAsync({}, { multi: true }) } - - static persist() { - return db.playlists.compactDatafileAsync() - } } function compactAllDatastores() { return Promise.allSettled([ - Settings.persist(), - History.persist(), - Profiles.persist(), - Playlists.persist(), + db.settings.compactDatafileAsync(), + db.history.compactDatafileAsync(), + db.profiles.compactDatafileAsync(), + db.playlists.compactDatafileAsync(), ]) } diff --git a/src/datastores/handlers/electron.js b/src/datastores/handlers/electron.js index 31e8c96305ece..6f57a7d83ba10 100644 --- a/src/datastores/handlers/electron.js +++ b/src/datastores/handlers/electron.js @@ -65,13 +65,6 @@ class History { { action: DBActions.GENERAL.DELETE_ALL } ) } - - static persist() { - return ipcRenderer.invoke( - IpcChannels.DB_HISTORY, - { action: DBActions.GENERAL.PERSIST } - ) - } } class Profiles { @@ -102,13 +95,6 @@ class Profiles { { action: DBActions.GENERAL.DELETE, data: id } ) } - - static persist() { - return ipcRenderer.invoke( - IpcChannels.DB_PROFILES, - { action: DBActions.GENERAL.PERSIST } - ) - } } class Playlists { diff --git a/src/datastores/handlers/web.js b/src/datastores/handlers/web.js index d5feccc998d07..d6073dc7039f3 100644 --- a/src/datastores/handlers/web.js +++ b/src/datastores/handlers/web.js @@ -44,10 +44,6 @@ class History { static deleteAll() { return baseHandlers.history.deleteAll() } - - static persist() { - baseHandlers.history.persist() - } } class Profiles { @@ -66,10 +62,6 @@ class Profiles { static delete(id) { return baseHandlers.profiles.delete(id) } - - static persist() { - baseHandlers.profiles.persist() - } } class Playlists { diff --git a/src/main/index.js b/src/main/index.js index 90da8cbdfd083..c97a7eb3f2aa4 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1053,10 +1053,6 @@ function runApp() { ) return null - case DBActions.GENERAL.PERSIST: - baseHandlers.history.persist() - return null - default: // eslint-disable-next-line no-throw-literal throw 'invalid history db action' @@ -1103,10 +1099,6 @@ function runApp() { ) return null - case DBActions.GENERAL.PERSIST: - baseHandlers.profiles.persist() - return null - default: // eslint-disable-next-line no-throw-literal throw 'invalid profile db action'