From 0ed9fe029da0bcbb850fecbc7514d8bd7d12409c Mon Sep 17 00:00:00 2001 From: Steve Faulkner <471400+southpolesteve@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:45:26 -0600 Subject: [PATCH] Fix Test DB cleanup conditional --- utils/cleanupDBs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/cleanupDBs.js b/utils/cleanupDBs.js index fbbab6f35..5d4a67d73 100644 --- a/utils/cleanupDBs.js +++ b/utils/cleanupDBs.js @@ -21,7 +21,7 @@ async function main() { const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name); for (const database of mongoDatabases) { const timestamp = Number(database.name.split("-")[1]); - if (timestamp || timestamp < twentyMinutesAgo) { + if (timestamp && timestamp < twentyMinutesAgo) { await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name); console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); } else { @@ -32,7 +32,7 @@ async function main() { const sqlDatabases = await client.sqlResources.listSqlDatabases(resourceGroupName, account.name); for (const database of sqlDatabases) { const timestamp = Number(database.name.split("-")[1]); - if (timestamp || timestamp < twentyMinutesAgo) { + if (timestamp && timestamp < twentyMinutesAgo) { await client.sqlResources.deleteSqlDatabase(resourceGroupName, account.name, database.name); console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); } else {