diff --git a/server/Db.js b/server/Db.js index de5c274a..bc88ca3e 100644 --- a/server/Db.js +++ b/server/Db.js @@ -24,15 +24,16 @@ class Db { this.SeriesPath = Path.join(global.ConfigPath, 'series') this.FeedsPath = Path.join(global.ConfigPath, 'feeds') - this.libraryItemsDb = new njodb.Database(this.LibraryItemsPath) - this.usersDb = new njodb.Database(this.UsersPath) - this.sessionsDb = new njodb.Database(this.SessionsPath) - this.librariesDb = new njodb.Database(this.LibrariesPath, { datastores: 2 }) - this.settingsDb = new njodb.Database(this.SettingsPath, { datastores: 2 }) - this.collectionsDb = new njodb.Database(this.CollectionsPath, { datastores: 2 }) - this.authorsDb = new njodb.Database(this.AuthorsPath) - this.seriesDb = new njodb.Database(this.SeriesPath, { datastores: 2 }) - this.feedsDb = new njodb.Database(this.FeedsPath, { datastores: 2 }) + const staleTime = 1000 * 60 * 2 + this.libraryItemsDb = new njodb.Database(this.LibraryItemsPath, { lockoptions: { stale: staleTime } }) + this.usersDb = new njodb.Database(this.UsersPath, { lockoptions: { stale: staleTime } }) + this.sessionsDb = new njodb.Database(this.SessionsPath, { lockoptions: { stale: staleTime } }) + this.librariesDb = new njodb.Database(this.LibrariesPath, { datastores: 2, lockoptions: { stale: staleTime } }) + this.settingsDb = new njodb.Database(this.SettingsPath, { datastores: 2, lockoptions: { stale: staleTime } }) + this.collectionsDb = new njodb.Database(this.CollectionsPath, { datastores: 2, lockoptions: { stale: staleTime } }) + this.authorsDb = new njodb.Database(this.AuthorsPath, { lockoptions: { stale: staleTime } }) + this.seriesDb = new njodb.Database(this.SeriesPath, { datastores: 2, lockoptions: { stale: staleTime } }) + this.feedsDb = new njodb.Database(this.FeedsPath, { datastores: 2, lockoptions: { stale: staleTime } }) this.libraryItems = [] this.users = []