mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[web] Delete library data when a deleted user expires (#36781)
* Delete library data when an expired deleted user is cleaned up * Refactor MongoDB session handling * Remove transaction handling from deleteAllLibraryDataForUser function * use findUserIdsToKeep rather than filterDanglingUserIds GitOrigin-RevId: 9e82f6bf943809b55a8b042d9240f99dbc635711
This commit is contained in:
committed by
Copybot
parent
42b29f0107
commit
a9ad734cf4
@@ -168,14 +168,24 @@ export async function waitForDb() {
|
||||
* MongoClient".
|
||||
*
|
||||
* @param {{ aux?: boolean }} [options]
|
||||
* @returns {Promise<import('mongodb').ClientSession>}
|
||||
*/
|
||||
export async function startSession({ aux = false } = {}) {
|
||||
let client
|
||||
if (aux && auxMongoClient) {
|
||||
await auxConnectionPromise
|
||||
return auxMongoClient.startSession()
|
||||
client = auxMongoClient
|
||||
} else {
|
||||
client = await connectionPromise
|
||||
}
|
||||
const client = await connectionPromise
|
||||
return client.startSession()
|
||||
|
||||
// The session is a real mongodb ClientSession at runtime, but mongodb-legacy
|
||||
// types its subclass via Omit, which drops ClientSession's private members and
|
||||
// makes it structurally incompatible — hence the single cast here rather than
|
||||
// at every call site.
|
||||
return /** @type {import('mongodb').ClientSession} */ (
|
||||
/** @type {unknown} */ (client.startSession())
|
||||
)
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user