Skip to content

Commit 048942b

Browse files
authored
Merge pull request #5605 from Countly/anna/next
Changes dor /data-cleanup scripts to support new events collections
2 parents 1fc67b4 + bb89873 commit 048942b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

bin/scripts/data-cleanup/delete_old_views.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ Promise.all([pluginManager.dbConnection("countly"), pluginManager.dbConnection("
9090
let view = await cursor.next();
9191
//Find one drill entry for the view with timestamp greater than expiration date
9292
var drillEntry = await drillSession.client.db("countly_drill").collection(collectionName).findOne({"sg.name": view.view, "ts": { $gt: expiration_timestamp }}, {ts: 1});
93+
var drillEntry2 = await drillSession.client.db("countly_drill").collection("drill_events").findOne({"a": app._id + "", "e": event, "sg.name": view.view, "ts": { $gt: expiration_timestamp }}, {ts: 1});
9394
//If no entry found, delete the view
94-
if (!drillEntry) {
95+
if (!drillEntry && !drillEntry2) {
9596
console.log("Deleting view: ", view.view);
9697
if (!DRY_RUN) {
9798
await new Promise(function(resolve) {

bin/scripts/data-cleanup/remove_old_crashes_sync.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Promise.all(
6767
count = await drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_crash" + app._id).digest('hex')).countDocuments({ ts: { $lt: lastUnixTimestamp * 1000 } });
6868
console.log("", count, "drill crashes to be deleted via command");
6969
console.log("", "", "", `db.drill_events${crypto.createHash('sha1').update("[CLY]_crash" + app._id).digest('hex')}.deleteMany({ ts: { $lt: ${lastUnixTimestamp * 1000} } })`);
70+
var count2 = await drillDb.collection("drill_events").countDocuments({"a": app._id + "", "e": "[CLY]_crash", ts: { $lt: lastUnixTimestamp * 1000 } });
71+
console.log("", count2, "drill crashes to be deleted via command");
72+
console.log("", "", "", `db.drill_events.deleteMany({"a": ${app._id}, "e": "[CLY]_crash", ts: { $lt: ${lastUnixTimestamp * 1000} } })`);
7073
checkThreshold(count);
7174
}
7275
else {
@@ -77,8 +80,12 @@ Promise.all(
7780
res = await db.collection(`app_crashes${app._id}`).deleteMany({ ts: { $lt: lastUnixTimestamp } });
7881
console.log("", res, "crashes deleted");
7982
await sleep(SLEEP);
83+
//deleting from old collection
8084
res = await drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_crash" + app._id).digest('hex')).deleteMany({ ts: { $lt: lastUnixTimestamp * 1000 } });
8185
console.log("", res, "drill crashes deleted");
86+
//deleting from amerged drill collection
87+
res = await drillDb.collection("drill_events").deleteMany({"a": app._id + "", "e": "[CLY]_crash", ts: { $lt: lastUnixTimestamp * 1000 } });
88+
console.log("", res, "drill crashes deleted");
8289
await sleep(SLEEP);
8390
}
8491
}

plugins/density/frontend/public/templates/density.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ <h4 data-test-id="densities-for-label">{{i18n('density.densities-for')}}</h4>
4646
</vue-scroll>
4747
</div>
4848
<h5 class="bu-pb-4" data-test-id="density-distribution-label"> {{i18n('density.distribution')}} </h5>
49-
<div v-if="densityVersions.length === 0 && isLoading">
49+
<div v-if="densityVersions.length === 0 && !isLoading" class="technology-density-wrapper__versions-empty-card bu-mb-5">
50+
<div class="text-medium" data-test-id="density-distribution-no-data-label">{{i18n('common.table.no-data')}}</div>
51+
</div>
52+
<div v-else-if="densityVersions.length === 0 && isLoading" class="bu-mb-5">
5053
<div style="height: 200px;" v-loading="isLoading"></div>
5154
</div>
5255
<div v-else v-loading="isLoading" class="technology-density-wrapper__versions">

0 commit comments

Comments
 (0)