From 1890d61fdcf7f1269cb65e5e05c4e952ede7eb63 Mon Sep 17 00:00:00 2001 From: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:39:26 -0700 Subject: [PATCH] update offline default max in storage time (#2386) --- channels/offline-channel-js/Tests/Unit/src/dbprovider.tests.ts | 2 +- channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts | 3 ++- channels/offline-channel-js/src/Providers/IndexDbProvider.ts | 2 +- .../offline-channel-js/src/Providers/WebStorageProvider.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/channels/offline-channel-js/Tests/Unit/src/dbprovider.tests.ts b/channels/offline-channel-js/Tests/Unit/src/dbprovider.tests.ts index 360dc2771..b805d84f3 100644 --- a/channels/offline-channel-js/Tests/Unit/src/dbprovider.tests.ts +++ b/channels/offline-channel-js/Tests/Unit/src/dbprovider.tests.ts @@ -56,7 +56,7 @@ export class OfflineDbProviderTests extends AITestClass { let expectedStorageKey = "AIOffline_1_dc.services.visualstudio.com"; Assert.equal(ctx[0], expectedStorageKey, "should have expected storage"); Assert.equal(ctx[1], "dc.services.visualstudio.com", "default endpoint is set"); - let expectedMaxStorageTime = 10080000; + let expectedMaxStorageTime = 604800000; Assert.equal(ctx[2], expectedMaxStorageTime, "default Max time is set"); Assert.ok(!provider.supportsSyncRequests(), "support sync should be set to false"); // this test will run database creation/dbupgrade as well diff --git a/channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts b/channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts index a1958e64a..bdc27e92a 100644 --- a/channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts +++ b/channels/offline-channel-js/src/Interfaces/IOfflineProvider.ts @@ -94,7 +94,8 @@ export interface IOfflineChannelConfiguration { /** * [Optional] Identifies the maximum time in ms that items should be in persistent storage. - * default: 10080000 (around 7days) + * default: 10080000 (around 2.8 hours) for versions <= 3.3.0 + * default: 604800000 (around 7days) for versions > 3.3.0 */ inStorageMaxTime?: number; diff --git a/channels/offline-channel-js/src/Providers/IndexDbProvider.ts b/channels/offline-channel-js/src/Providers/IndexDbProvider.ts index 96885ac0b..a347baae3 100644 --- a/channels/offline-channel-js/src/Providers/IndexDbProvider.ts +++ b/channels/offline-channel-js/src/Providers/IndexDbProvider.ts @@ -19,7 +19,7 @@ import { IndexedDbHelper } from "./IndexDbHelper"; //TODO: move all const to one file const EventsToDropAtOneTime = 10; // If we fail to add a new event this is the max number of events we will attempt to remove to make space const StoreVersion = 1; // The Current version for the stored items, this will be used in the future for versioning -const OrhpanedEventThresholdInMs = 10080000; // 7 days +const OrhpanedEventThresholdInMs = 604800000; // 7 days const UnknowniKey = "Unknown"; const ErrorMessageUnableToAddEvent = "DBError: Unable to add event"; const MaxCriticalEvtsDropCnt = 2; diff --git a/channels/offline-channel-js/src/Providers/WebStorageProvider.ts b/channels/offline-channel-js/src/Providers/WebStorageProvider.ts index c414fbb9a..25f39194f 100644 --- a/channels/offline-channel-js/src/Providers/WebStorageProvider.ts +++ b/channels/offline-channel-js/src/Providers/WebStorageProvider.ts @@ -19,7 +19,7 @@ const Version = "1"; const DefaultStorageKey = "AIOffline"; const DefaultMaxStorageSizeInBytes = 5000000; const MaxCriticalEvtsDropCnt = 2; -const DefaultMaxInStorageTime = 10080000; //7*24*60*60*1000 7days +const DefaultMaxInStorageTime = 604800000; //7*24*60*60*1000 7days // [Optional for version 1]: TODO: order event by time interface IJsonStoreDetails {