File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
packages/data-service/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2137,7 +2137,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
2137
2137
private async _indexProgress ( ns : string ) : Promise < Record < string , number > > {
2138
2138
type IndexProgressResult = {
2139
2139
_id : string ;
2140
- progress : { done : number ; total : number } ;
2140
+ progress : number ;
2141
2141
} ;
2142
2142
2143
2143
const currentOps : IndexProgressResult [ ] = await this . _database (
@@ -2157,7 +2157,15 @@ class DataServiceImpl extends WithLogContext implements DataService {
2157
2157
{
2158
2158
$group : {
2159
2159
_id : '$command.indexes.name' ,
2160
- progress : { $first : '$progress' } ,
2160
+ progress : {
2161
+ $first : {
2162
+ $cond : {
2163
+ if : { $gt : [ '$progress.total' , 0 ] } ,
2164
+ then : { $divide : [ '$progress.done' , '$progress.total' ] } ,
2165
+ else : 0 ,
2166
+ } ,
2167
+ } ,
2168
+ } ,
2161
2169
} ,
2162
2170
} , // group on index name
2163
2171
] )
@@ -2166,7 +2174,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
2166
2174
2167
2175
const indexToProgress = Object . create ( null ) ;
2168
2176
for ( const { _id, progress } of currentOps ) {
2169
- indexToProgress [ _id ] = progress . done / progress . total ;
2177
+ indexToProgress [ _id ] = progress ;
2170
2178
}
2171
2179
2172
2180
return indexToProgress ;
You can’t perform that action at this time.
0 commit comments