src/database/client.js
/**
 * Create session expiry check loop
 * @returns {NodeJS.Timer}
 */
Create session expiry check loop
@returns {NodeJS.Timer}
Create session expiry check loop @returns { NodeJS . Timer }
async function createExpiryCheckLoop() {
    const check = async () => {
        await prepareConnection()
        for await (const session of authenticationSessionModel.find()) {
            if (parseInt(session.timestamp, 10) + expiryForStatuses[session.status] < new Date().getTime()) {
                await authenticationSessionModel.deleteOne({ id: session.id })
            }
        }
    }
    check() 
    return setInterval(check, 30000) 
}
async function createExpiryCheckLoop ( ) { const check = async ( ) => { await prepareConnection ( ) for await ( const session of authenticationSessionModel . find ( ) ) { if ( parseInt ( session . timestamp , 10 ) + expiryForStatuses [ session . status ] < new Date ( ) . getTime ( ) ) { await authenticationSessionModel . deleteOne ( { id : session . id } ) } } } check ( ) return setInterval ( check , 30000 ) }
Create session expiry check loop
 @returns {NodeJS.Timer}
Create session expiry check loop @returns { NodeJS . Timer }
// Run once immediately // Run every 30 seconds