Fix Test DB cleanup conditional

This commit is contained in:
Steve Faulkner 2021-03-08 10:45:26 -06:00
parent 45af1d7cf9
commit 0ed9fe029d
1 changed files with 2 additions and 2 deletions

View File

@ -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 {