refactor(server): job handlers (#2572)

* refactor(server): job handlers

* chore: remove comment

* chore: add comments for
This commit is contained in:
Jason Rasmussen
2023-05-26 15:43:24 -04:00
committed by GitHub
parent d6756f3d81
commit 1c2d83e2c7
33 changed files with 807 additions and 1082 deletions

View File

@@ -122,14 +122,5 @@ describe(PersonService.name, () => {
data: { files: ['/path/to/thumbnail'] },
});
});
it('should log an error', async () => {
personMock.getAllWithoutFaces.mockResolvedValue([personStub.noName]);
personMock.delete.mockRejectedValue(new Error('database unavailable'));
await sut.handlePersonCleanup();
expect(jobMock.queue).not.toHaveBeenCalled();
});
});
});

View File

@@ -67,7 +67,7 @@ export class PersonService {
return mapPerson(person);
}
async handlePersonCleanup(): Promise<void> {
async handlePersonCleanup() {
const people = await this.repository.getAllWithoutFaces();
for (const person of people) {
this.logger.debug(`Person ${person.name || person.id} no longer has any faces, deleting.`);
@@ -78,5 +78,7 @@ export class PersonService {
this.logger.error(`Unable to delete person: ${error}`, error?.stack);
}
}
return true;
}
}