File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -441,6 +441,8 @@ async function buildModel (
441441 )
442442 } )
443443
444+ userTx . sort ( compareTxes )
445+
444446 let txes = systemTx . concat ( userTx )
445447 if ( modelFilter !== undefined ) {
446448 txes = await modelFilter ( txes )
@@ -473,3 +475,8 @@ function getLastTxTime (txes: Tx[]): number {
473475 }
474476 return lastTxTime
475477}
478+
479+ function compareTxes ( a : Tx , b : Tx ) : number {
480+ const result = a . _id . localeCompare ( b . _id )
481+ return result !== 0 ? result : a . modifiedOn - b . modifiedOn
482+ }
Original file line number Diff line number Diff line change @@ -1613,7 +1613,7 @@ class MongoTxAdapter extends MongoAdapterBase implements TxAdapter {
16131613 @withContext ( 'get-model' )
16141614 async getModel ( ctx : MeasureContext ) : Promise < Tx [ ] > {
16151615 const txCollection = this . db . collection < Tx > ( DOMAIN_TX )
1616- const cursor = txCollection . find ( { objectSpace : core . space . Model } )
1616+ const cursor = txCollection . find ( { objectSpace : core . space . Model } , { sort : { _id : 1 , modifiedOn : 1 } } )
16171617 const model = await toArray < Tx > ( cursor )
16181618 // We need to put all core.account.System transactions first
16191619 const systemTx : Tx [ ] = [ ]
You can’t perform that action at this time.
0 commit comments