Bug 1295555 - Lower client-side ping archive retention period to 60 days. r=dexter

This commit is contained in:
Georg Fritzsche 2016-10-06 11:07:04 +02:00
Родитель 55ce4ad9bf
Коммит 7ff8e8b5f4
2 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -50,7 +50,7 @@ XPCOMUtils.defineLazyGetter(this, "gDeletionPingFilePath", function() {
XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
"resource://services-common/utils.js");
// Maxmimum time, in milliseconds, archive pings should be retained.
const MAX_ARCHIVED_PINGS_RETENTION_MS = 180 * 24 * 60 * 60 * 1000; // 180 days
const MAX_ARCHIVED_PINGS_RETENTION_MS = 60 * 24 * 60 * 60 * 1000; // 60 days
// Maximum space the archive can take on disk (in Bytes).
const ARCHIVE_QUOTA_BYTES = 120 * 1024 * 1024; // 120 MB

Просмотреть файл

@ -236,6 +236,7 @@ add_task(function* test_archiveCleanup() {
// Create a ping which should be pruned because it is past the retention period.
let date = fakeNow(2010, 1, 1, 1, 0, 0);
let firstDate = date;
let pingId = yield TelemetryController.submitExternalPing(PING_TYPE, {}, {});
expectedPrunedInfo.push({ id: pingId, creationDate: date });
@ -261,8 +262,8 @@ add_task(function* test_archiveCleanup() {
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_EVICTED_OLD_DIRS").clear();
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_OLDEST_DIRECTORY_AGE").clear();
// Move the current date 180 days ahead of the first ping.
let now = fakeNow(2010, 7, 1, 1, 0, 0);
// Move the current date 60 days ahead of the first ping.
let now = fakeNow(futureDate(firstDate, 60 * MILLISECONDS_PER_DAY));
// Reset TelemetryArchive and TelemetryController to start the startup cleanup.
yield TelemetryController.testReset();
// Wait for the cleanup to finish.
@ -283,7 +284,7 @@ add_task(function* test_archiveCleanup() {
h = Telemetry.getHistogramById("TELEMETRY_ARCHIVE_DIRECTORIES_COUNT").snapshot();
Assert.equal(h.sum, 3, "Telemetry must correctly report the remaining archive directories.");
// Check that the remaining directories are correctly counted.
const oldestAgeInMonths = 5;
const oldestAgeInMonths = 1;
h = Telemetry.getHistogramById("TELEMETRY_ARCHIVE_OLDEST_DIRECTORY_AGE").snapshot();
Assert.equal(h.sum, oldestAgeInMonths,
"Telemetry must correctly report age of the oldest directory in the archive.");
@ -294,8 +295,8 @@ add_task(function* test_archiveCleanup() {
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_EVICTED_OVER_QUOTA").clear();
Telemetry.getHistogramById("TELEMETRY_ARCHIVE_EVICTING_OVER_QUOTA_MS").clear();
// Move the current date 180 days ahead of the second ping.
fakeNow(2010, 8, 1, 1, 0, 0);
// Move the current date 60 days ahead of the second ping.
fakeNow(futureDate(oldestDirectoryDate, 60 * MILLISECONDS_PER_DAY));
// Reset TelemetryController and TelemetryArchive.
yield TelemetryController.testReset();
// Wait for the cleanup to finish.