Fix Get model hint (#6163)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-07-29 15:48:15 +07:00 committed by GitHub
parent 81429df8cf
commit 6377a3e48a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 8 deletions

View File

@ -158,7 +158,7 @@ services:
limits:
memory: 1024M
print:
image: hardcoreeng/uberflow-print
image: hardcoreeng/print
restart: unless-stopped
ports:
- 4005:4005
@ -171,7 +171,7 @@ services:
limits:
memory: 300M
sign:
image: hardcoreeng/uberflow-sign
image: hardcoreeng/sign
restart: unless-stopped
ports:
- 4006:4006
@ -193,7 +193,7 @@ services:
limits:
memory: 300M
analytics:
image: hardcoreeng/uberflow-analytics-collector
image: hardcoreeng/analytics-collector
restart: unless-stopped
ports:
- 4077:4007

View File

@ -81,9 +81,9 @@ import {
type Document,
type Filter,
type FindCursor,
type FindOptions as MongoFindOptions,
type Sort,
type UpdateFilter,
type FindOptions as MongoFindOptions
type UpdateFilter
} from 'mongodb'
import { DBCollectionHelper, getMongoClient, getWorkspaceDB, type MongoClientReference } from './utils'
@ -1477,8 +1477,10 @@ class MongoTxAdapter extends MongoAdapterBase implements TxAdapter {
@withContext('get-model')
async getModel (ctx: MeasureContext): Promise<Tx[]> {
const cursor = await ctx.with('find', {}, async () =>
this.db.collection<Tx>(DOMAIN_TX).find(
const txCollection = this.db.collection<Tx>(DOMAIN_TX)
const exists = await txCollection.indexExists('objectSpace_fi_1__id_fi_1_modifiedOn_fi_1')
const cursor = await ctx.with('find', {}, async () => {
let c = txCollection.find(
{ objectSpace: core.space.Model },
{
sort: {
@ -1490,7 +1492,11 @@ class MongoTxAdapter extends MongoAdapterBase implements TxAdapter {
}
}
)
)
if (exists) {
c = c.hint({ objectSpace: 1, _id: 1, modifiedOn: 1 })
}
return c
})
const model = await ctx.with('to-array', {}, async () => await toArray<Tx>(cursor))
// We need to put all core.account.System transactions first
const systemTx: Tx[] = []