Skip to content

Commit 2c0cb76

Browse files
committed
throwing error in deleteUserRefIncludingChildren() when user has a tokens-wallet entry, so that it can be considered as a failure in overall statistics
1 parent d92512c commit 2c0cb76

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cloud/functions/src/functions/firestore/services/user-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async function deleteUserRefIncludingChildren(userRef: DocumentReference<Documen
132132
|| (walletSecrets.talkFeedbacksViewerTokens && walletSecrets.talkFeedbacksViewerTokens.length)
133133
)) {
134134
console.info(`Not deleting user ${userRef.id} because he has tokens-wallet non-empty collection`)
135-
return;
135+
throw new Error(`Not deleting user ${userRef.id} because he has tokens-wallet non-empty collection`)
136136
}
137137

138138
const preferencesDoc = await db.doc(`${userRef.path}/preferences/self`).get()

cloud/functions/src/functions/http/api/admin-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function declareAdminHttpRoutes(app: Express) {
3232
async (res, path, { dryRun, force }, body) => {
3333
const results = await (await import("../../../cron/cleanOutdatedUsers")).cleanOutdatedUsers({ dryRun, force });
3434
return sendResponseMessage(res, 200, {
35-
message: `${results.totalDeletedUsers} users have been deleted (in ${results.totalDuration}ms) !`,
35+
message: `${results.totalDeletedUsers} users have been deleted and ${results.failures} have failed to be deleted (in ${results.totalDuration}ms) !`,
3636
results
3737
})
3838
})

0 commit comments

Comments
 (0)