Skip to content

Commit 7a03079

Browse files
authored
Refactor comments for clarity and consistency
1 parent 16857a8 commit 7a03079

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

config/var/www/admin/control-panel/external-services/external-services.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const SETTINGS_INSTRUCTION_TEXT = 'Toggle services to show/hide on the dashboard
3131

3232
const DEFAULT_ICON_SUFFIX = 'question';
3333

34-
const SERVICE_CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes in milliseconds
34+
const SERVICE_CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
3535
const SERVICE_CACHE_MAX_SIZE = 100; // Limit cache size to prevent memory growth
3636

3737
const DEFAULT_NOTIFICATION_DURATION_MS = 3000;
@@ -51,7 +51,7 @@ export class ExternalServicesManager {
5151
this.container = document.querySelector(containerSelector);
5252
this.settingsContainer = document.querySelector(settingsContainerSelector);
5353

54-
// State management with TTL cache and LRU eviction (5-minute TTL, max 100 entries)
54+
// State management with TTL cache and LRU eviction (configured by SERVICE_CACHE_TTL_MS and SERVICE_CACHE_MAX_SIZE)
5555
this.serviceCache = new Map();
5656
this.cacheTTL = SERVICE_CACHE_TTL_MS;
5757
this.cacheMaxSize = SERVICE_CACHE_MAX_SIZE;
@@ -579,7 +579,7 @@ export class ExternalServicesManager {
579579
const areAllCategoryServicesEnabled = () => categoryCheckboxes.every(cb => cb.checked);
580580
const toggleTextEl = toggleBtn.querySelector(".toggle-all-text");
581581
if (!toggleTextEl) {
582-
throw new Error("Expected .toggle-all-text span in category toggle button.");
582+
throw new Error(`Expected .toggle-all-text span in category toggle button for category: ${category}.`);
583583
}
584584
const updateToggleButtonState = () => {
585585
const allEnabled = areAllCategoryServicesEnabled();
@@ -1074,7 +1074,7 @@ export class ExternalServicesManager {
10741074
* @param {Function} requestFn - Async function that performs the actual request
10751075
* @returns {Promise} Resolves when request completes
10761076
*/
1077-
// NOTE: constructor should initialize all stateful request-management fields, including:
1077+
// NOTE: constructor initializes all stateful request-management fields, including:
10781078
// this.inFlightRequests = {};
10791079
async queueRequest(requestFn) {
10801080
return new Promise((resolve, reject) => {
@@ -1306,7 +1306,7 @@ export class ExternalServicesManager {
13061306

13071307
/**
13081308
* Set cached service data with LRU eviction
1309-
* Implements LRU cache with max size of 100 entries
1309+
* Implements LRU cache with configured max size (`this.cacheMaxSize`)
13101310
* @param {string} serviceKey - Service identifier key
13111311
* @param {Object} data - Service data to cache
13121312
* @returns {void}

0 commit comments

Comments
 (0)