feat: minimum support for unrefed object cleanup
This commit is contained in:
@@ -73,7 +73,7 @@ class LibraryManager {
|
||||
metadataSource: true,
|
||||
mDevelopers: true,
|
||||
mPublishers: true,
|
||||
mIconId: true,
|
||||
mIconObjectId: true,
|
||||
libraryBasePath: true,
|
||||
},
|
||||
orderBy: {
|
||||
|
||||
@@ -174,10 +174,10 @@ export class MetadataHandler {
|
||||
mReviewRating: metadata.reviewRating,
|
||||
mReleased: metadata.released,
|
||||
|
||||
mIconId: metadata.icon,
|
||||
mBannerId: metadata.bannerId,
|
||||
mCoverId: metadata.coverId,
|
||||
mImageLibrary: metadata.images,
|
||||
mIconObjectId: metadata.icon,
|
||||
mBannerObjectId: metadata.bannerId,
|
||||
mCoverObjectId: metadata.coverId,
|
||||
mImageLibraryObjectIds: metadata.images,
|
||||
|
||||
libraryBasePath,
|
||||
},
|
||||
|
||||
@@ -77,7 +77,7 @@ class SaveManager {
|
||||
},
|
||||
},
|
||||
data: {
|
||||
history: {
|
||||
historyObjectIds: {
|
||||
push: newSaveObjectId,
|
||||
},
|
||||
historyChecksums: {
|
||||
@@ -88,12 +88,12 @@ class SaveManager {
|
||||
});
|
||||
|
||||
const historyLimit = await applicationSettings.get("saveSlotHistoryLimit");
|
||||
if (newSave.history.length > historyLimit) {
|
||||
if (newSave.historyObjectIds.length > historyLimit) {
|
||||
// Delete previous
|
||||
const safeFromIndex = newSave.history.length - historyLimit;
|
||||
const safeFromIndex = newSave.historyObjectIds.length - historyLimit;
|
||||
|
||||
const toDelete = newSave.history.slice(0, safeFromIndex);
|
||||
const toKeepObjects = newSave.history.slice(safeFromIndex);
|
||||
const toDelete = newSave.historyObjectIds.slice(0, safeFromIndex);
|
||||
const toKeepObjects = newSave.historyObjectIds.slice(safeFromIndex);
|
||||
const toKeepHashes = newSave.historyChecksums.slice(safeFromIndex);
|
||||
|
||||
// Delete objects first, so if we error out, we don't lose track of objects in backend
|
||||
@@ -110,7 +110,7 @@ class SaveManager {
|
||||
},
|
||||
},
|
||||
data: {
|
||||
history: toKeepObjects,
|
||||
historyObjectIds: toKeepObjects,
|
||||
historyChecksums: toKeepHashes,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user