mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
fix(server): deadlock when fetching vector count (#18728)
move row count query
This commit is contained in:
parent
78224961d1
commit
be247395db
@ -246,6 +246,7 @@ export class DatabaseRepository {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dimSize = await this.getDimensionSize(table);
|
const dimSize = await this.getDimensionSize(table);
|
||||||
|
lists ||= this.targetListCount(await this.getRowCount(table));
|
||||||
await this.db.schema.dropIndex(indexName).ifExists().execute();
|
await this.db.schema.dropIndex(indexName).ifExists().execute();
|
||||||
if (table === 'smart_search') {
|
if (table === 'smart_search') {
|
||||||
await this.db.schema.alterTable(table).dropConstraint('dim_size_constraint').ifExists().execute();
|
await this.db.schema.alterTable(table).dropConstraint('dim_size_constraint').ifExists().execute();
|
||||||
@ -262,7 +263,6 @@ export class DatabaseRepository {
|
|||||||
ALTER TABLE ${sql.raw(table)}
|
ALTER TABLE ${sql.raw(table)}
|
||||||
ALTER COLUMN embedding
|
ALTER COLUMN embedding
|
||||||
SET DATA TYPE ${sql.raw(schema)}vector(${sql.raw(String(dimSize))})`.execute(tx);
|
SET DATA TYPE ${sql.raw(schema)}vector(${sql.raw(String(dimSize))})`.execute(tx);
|
||||||
lists ||= this.targetListCount(await this.getRowCount(table));
|
|
||||||
await sql.raw(vectorIndexQuery({ vectorExtension, table, indexName, lists })).execute(tx);
|
await sql.raw(vectorIndexQuery({ vectorExtension, table, indexName, lists })).execute(tx);
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user