Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
24 changes: 4 additions & 20 deletions src/datastores/handlers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -75,10 +71,6 @@ class History {
static deleteAll() {
return db.history.removeAsync({}, { multi: true })
}

static persist() {
return db.history.compactDatafileAsync()
}
}

class Profiles {
Expand All @@ -97,10 +89,6 @@ class Profiles {
static delete(id) {
return db.profiles.removeAsync({ _id: id })
}

static persist() {
return db.profiles.compactDatafileAsync()
}
}

class Playlists {
Expand Down Expand Up @@ -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(),
])
}

Expand Down
14 changes: 0 additions & 14 deletions src/datastores/handlers/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 0 additions & 8 deletions src/datastores/handlers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ class History {
static deleteAll() {
return baseHandlers.history.deleteAll()
}

static persist() {
baseHandlers.history.persist()
}
}

class Profiles {
Expand All @@ -66,10 +62,6 @@ class Profiles {
static delete(id) {
return baseHandlers.profiles.delete(id)
}

static persist() {
baseHandlers.profiles.persist()
}
}

class Playlists {
Expand Down
8 changes: 0 additions & 8 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down