chore(server): eslint await-thenable (#7545)
* await-thenable * fix library watchers * moar eslint * fix test * fix typo * try to remove check void return * fix checksVoidReturn * move to domain utils * remove eslint ignores * chore: cleanup types * chore: use logger * fix: e2e --------- Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
committed by
GitHub
parent
972d5a3411
commit
5d377e5b0f
@@ -13,7 +13,7 @@ describe(DatabaseService.name, () => {
|
||||
let sut: DatabaseService;
|
||||
let databaseMock: jest.Mocked<IDatabaseRepository>;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
databaseMock = newDatabaseRepositoryMock();
|
||||
|
||||
sut = new DatabaseService(databaseMock);
|
||||
@@ -31,7 +31,7 @@ describe(DatabaseService.name, () => {
|
||||
let errorLog: jest.SpyInstance;
|
||||
let warnLog: jest.SpyInstance;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
fatalLog = jest.spyOn(ImmichLogger.prototype, 'fatal');
|
||||
errorLog = jest.spyOn(ImmichLogger.prototype, 'error');
|
||||
warnLog = jest.spyOn(ImmichLogger.prototype, 'warn');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ImmichLogger } from '@app/infra/logger';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { QueryFailedError } from 'typeorm';
|
||||
import { Version, VersionType } from '../domain.constant';
|
||||
import {
|
||||
DatabaseExtension,
|
||||
@@ -61,7 +60,9 @@ export class DatabaseService {
|
||||
}
|
||||
|
||||
private async createVectorExtension() {
|
||||
await this.databaseRepository.createExtension(this.vectorExt).catch(async (error: QueryFailedError) => {
|
||||
try {
|
||||
await this.databaseRepository.createExtension(this.vectorExt);
|
||||
} catch (error) {
|
||||
const otherExt =
|
||||
this.vectorExt === DatabaseExtension.VECTORS ? DatabaseExtension.VECTOR : DatabaseExtension.VECTORS;
|
||||
this.logger.fatal(`
|
||||
@@ -78,7 +79,7 @@ export class DatabaseService {
|
||||
In this case, you may set either extension now, but you will not be able to switch to the other extension following a successful startup.
|
||||
`);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async updateVectorExtension() {
|
||||
|
||||
Reference in New Issue
Block a user