mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBERF-8620: Fix OOM in fulltext service (#7263)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
8ba52a99eb
commit
27b54e5821
@ -423,20 +423,6 @@ export const coreOperation: MigrateOperation = {
|
||||
await client.update(DOMAIN_SPACE, { '%hash%': { $exists: true } }, { $set: { '%hash%': null } })
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'remove-github-patches',
|
||||
func: async (client) => {
|
||||
await client.update(
|
||||
DOMAIN_TX,
|
||||
{
|
||||
objectClass: 'tracker:class:Issue',
|
||||
collection: 'pullRequests',
|
||||
'tx.attributes.patch': { $exists: true }
|
||||
},
|
||||
{ $unset: { 'tx.attributes.patch': 1 } }
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'remove-collection-txes',
|
||||
func: async (client) => {
|
||||
|
@ -237,6 +237,13 @@ abstract class MongoAdapterBase implements DbAdapter {
|
||||
cursor = cursor.sort(sort)
|
||||
}
|
||||
}
|
||||
if (options?.projection !== undefined) {
|
||||
const projection: Projection<T> = {}
|
||||
for (const key in options.projection ?? []) {
|
||||
projection[key] = options.projection[key]
|
||||
}
|
||||
cursor = cursor.project(projection)
|
||||
}
|
||||
return await cursor.toArray()
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
|
||||
async rawFindAll<T extends Doc>(_domain: Domain, query: DocumentQuery<T>, options?: FindOptions<T>): Promise<T[]> {
|
||||
const domain = translateDomain(_domain)
|
||||
const select = `SELECT * FROM ${domain}`
|
||||
const select = `SELECT ${this.getProjection(domain, options?.projection, [])} FROM ${domain}`
|
||||
const sqlChunks: string[] = []
|
||||
sqlChunks.push(`WHERE ${this.buildRawQuery(domain, query, options)}`)
|
||||
if (options?.sort !== undefined) {
|
||||
@ -564,7 +564,7 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
toClass: undefined
|
||||
})
|
||||
}
|
||||
const select = `SELECT ${this.getProjection(_class, domain, options?.projection, joins)} FROM ${domain}`
|
||||
const select = `SELECT ${this.getProjection(domain, options?.projection, joins)} FROM ${domain}`
|
||||
const secJoin = this.addSecurity(query, domain, ctx.contextData)
|
||||
if (secJoin !== undefined) {
|
||||
sqlChunks.push(secJoin)
|
||||
@ -1232,7 +1232,6 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
}
|
||||
|
||||
private getProjection<T extends Doc>(
|
||||
_class: Ref<Class<T>>,
|
||||
baseDomain: string,
|
||||
projection: Projection<T> | undefined,
|
||||
joins: JoinProps[]
|
||||
|
Loading…
Reference in New Issue
Block a user