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:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-11 03:27:26 +00:00
1 parent 83d8023767
commit c47392aba6
17 files changed
+92 -47

No files matched your search

+3 -2
View File
@@ -1,7 +1,8 @@
import { devLogger } from "../utils/logger.js";
import { FIVE_MINUTES_MS, ONE_MINUTE_MS } from "../constants.js";
const DEFAULT_IDF_REFRESH_INTERVAL_MS = 5 * 60 * 1000;
const DEFAULT_HISTORY_REFRESH_INTERVAL_MS = 60 * 1000;
const DEFAULT_IDF_REFRESH_INTERVAL_MS = FIVE_MINUTES_MS;
const DEFAULT_HISTORY_REFRESH_INTERVAL_MS = ONE_MINUTE_MS;
const DEFAULT_REFRESH_DEBOUNCE_MS = 200;
let workerInstance = null;