Most recent file IDs first
This commit is contained in:
@@ -394,14 +394,23 @@ export const indexableAndIndexedCounts = async () => {
|
||||
* universe, we filter out fileIDs the files corresponding to which have already
|
||||
* been indexed, or which should be ignored.
|
||||
*
|
||||
* @param count Limit the result to up to {@link count} items.
|
||||
* @param count Limit the result to up to {@link count} items. If there are more
|
||||
* than {@link count} items present, the files with the higher file IDs (which
|
||||
* can be taken as a approximate for their creation order) are preferred.
|
||||
*/
|
||||
export const indexableFileIDs = async (count?: number) => {
|
||||
export const indexableFileIDs = async (count: number) => {
|
||||
const db = await mlDB();
|
||||
const tx = db.transaction("file-status", "readonly");
|
||||
return tx.store
|
||||
let cursor = await tx.store
|
||||
.index("status")
|
||||
.getAllKeys(IDBKeyRange.only("indexable"), count);
|
||||
.openKeyCursor(IDBKeyRange.only("indexable"), "prev");
|
||||
const result: number[] = [];
|
||||
while (cursor && count > 0) {
|
||||
result.push(cursor.primaryKey);
|
||||
cursor = await cursor.continue();
|
||||
count -= 1;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -339,6 +339,8 @@ const indexNextBatch = async (
|
||||
* about. Then return the next {@link count} files that still need to be
|
||||
* indexed.
|
||||
*
|
||||
* When returning from amongst pending files, prefer the most recent ones first.
|
||||
*
|
||||
* For specifics of what a "sync" entails, see {@link updateAssumingLocalFiles}.
|
||||
*
|
||||
* @param userID Sync only files owned by a {@link userID} with the face DB.
|
||||
|
||||
Reference in New Issue
Block a user