Skip to content

Commit

Permalink
#684 minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1844 committed Oct 21, 2022
1 parent 3555bd8 commit c5e7a36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arangodb-foxx-services/src/main/services/prune-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,20 @@ export function pruneBefore(timestamp) {
const collections = ['executes', 'operation', 'follows', 'uses', 'expression', 'affects', 'depends', 'writesTo', 'readsFrom', 'emits', 'produces', 'consistsOf', 'derivesFrom', 'computedBy', 'takes', 'schema', 'attribute']
for (let i = 0; i < collections.length; i++) {
console.log('### Working on', collections[i], 'collection')
let startCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
const startCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
db._query('FOR orphanExecPlanID IN @arr FOR collectionEle IN @@cols FILTER collectionEle._belongsTo == orphanExecPlanID && collectionEle._created < @purgeLimitTimestamp REMOVE collectionEle IN @@cols',
{
'arr': orphanExecPlanIDsOlderThanThresholdDaysArray,
'@cols': collections[i],
'purgeLimitTimestamp': timestamp
}
)
let endCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
const endCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
console.log(startCount - endCount, collections[i], 'objects deleted...')
}

////////////////////////////////////////////////////////////////////////
// reused below
let startCount = 0
let endCount = 0

Expand Down

0 comments on commit c5e7a36

Please sign in to comment.