Update CleanRemoteNotesProcessorService.ts
This commit is contained in:
parent
fd15a90b77
commit
a7e221ba25
|
@ -58,6 +58,7 @@ export class CleanRemoteNotesProcessorService {
|
||||||
},
|
},
|
||||||
take: 50,
|
take: 50,
|
||||||
order: {
|
order: {
|
||||||
|
// 古い順
|
||||||
id: 1,
|
id: 1,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -70,6 +71,10 @@ export class CleanRemoteNotesProcessorService {
|
||||||
await this.notesRepository.delete(notes.map(note => note.id));
|
await this.notesRepository.delete(notes.map(note => note.id));
|
||||||
|
|
||||||
for (const note of notes) {
|
for (const note of notes) {
|
||||||
|
if (cursor === null || note.id > cursor) {
|
||||||
|
cursor = note.id;
|
||||||
|
}
|
||||||
|
|
||||||
const t = this.idService.parse(note.id).date.getTime();
|
const t = this.idService.parse(note.id).date.getTime();
|
||||||
if (stats.oldest === null || t < stats.oldest) {
|
if (stats.oldest === null || t < stats.oldest) {
|
||||||
stats.oldest = t;
|
stats.oldest = t;
|
||||||
|
@ -79,8 +84,6 @@ export class CleanRemoteNotesProcessorService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = notes.at(-1)?.id ?? null;
|
|
||||||
|
|
||||||
stats.deletedCount += notes.length;
|
stats.deletedCount += notes.length;
|
||||||
|
|
||||||
const elapsed = Date.now() - startAt;
|
const elapsed = Date.now() - startAt;
|
||||||
|
|
Loading…
Reference in New Issue