Skip to content

Commit

Permalink
lib/cache: Fix mistakenly deleted cache on title update
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Apr 3, 2018
1 parent b1d6c1f commit 04f2e33
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libs/cache.js
Expand Up @@ -86,9 +86,10 @@ class Cache {
if (data) {
// setter
// re-save full object - NeDB issue with $set on object workaround - NeDB is not deleting missing keys
let fullCacheObj = await global.db.engine.findOne('cache')
let fullCacheObj = await global.db.engine.findOne('cache', { key: 'gamesTitles' })
fullCacheObj['games_and_titles'] = data
await global.db.engine.remove('cache', {})
delete fullCacheObj._id
await global.db.engine.remove('cache', { key: 'gamesTitles' })
await global.db.engine.insert('cache', fullCacheObj)
return data
} else {
Expand Down

0 comments on commit 04f2e33

Please sign in to comment.