mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 13:22:54 +00:00
Refactor numeric constants to centralized module
- Introduce `js/constants.js` with semantic time constants (e.g., `ONE_MINUTE_MS`, `STANDARD_TIMEOUT_MS`) and feature-specific TTLs. - Export `KIND_MUTE_LIST` from `js/nostrEventSchemas.js` to standardize NIP-51 mute list kind usage. - Refactor `js/state/cache.js`, `js/nostr/cachePolicies.js`, `js/channelProfile.js`, and various services to use centralized constants instead of hardcoded magic numbers. - Update `js/nostr/relayConstants.js` to derive values from the shared time constants. - Replace duplicate definitions of timeouts and retry delays across the codebase. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
83d8023767
commit
c47392aba6
17 files changed
+92
-47
No files matched your search
+6
-4
@@ -5,6 +5,10 @@ import {
|
||||
DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD,
|
||||
getTrustedMuteHideThreshold,
|
||||
getTrustedSpamHideThreshold,
|
||||
PROFILE_CACHE_TTL_MS,
|
||||
URL_HEALTH_TTL_MS,
|
||||
URL_HEALTH_RETRY_MS,
|
||||
URL_PROBE_TIMEOUT_MS,
|
||||
} from "../constants.js";
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import { sanitizeProfileMediaUrl } from "../utils/profileMedia.js";
|
||||
@@ -17,14 +21,12 @@ import createProfileSettingsStore from "./profileSettingsStore.js";
|
||||
|
||||
const PROFILE_CACHE_STORAGE_KEY = "bitvid:profileCache:v1";
|
||||
const PROFILE_CACHE_VERSION = 1;
|
||||
const PROFILE_CACHE_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
||||
|
||||
const SAVED_PROFILES_STORAGE_KEY = "bitvid:savedProfiles:v1";
|
||||
const SAVED_PROFILES_STORAGE_VERSION = 1;
|
||||
|
||||
const URL_HEALTH_TTL_MS = 45 * 60 * 1000; // 45 minutes
|
||||
const URL_HEALTH_TIMEOUT_RETRY_MS = 5 * 60 * 1000; // 5 minutes
|
||||
export const URL_PROBE_TIMEOUT_MS = 8 * 1000; // 8 seconds
|
||||
const URL_HEALTH_TIMEOUT_RETRY_MS = URL_HEALTH_RETRY_MS;
|
||||
export { URL_PROBE_TIMEOUT_MS };
|
||||
const URL_PROBE_TIMEOUT_RETRY_MS = 15 * 1000; // 15 seconds
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user