mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 22:02:54 +00:00
perf: bound DM subsystem network concurrency & fix CI lint/tests
- Replaced unbounded `Promise.all` with `pMap` and `RELAY_BACKGROUND_CONCURRENCY || 3` in `js/nostr/dmSignalEvents.js` and `js/services/dmNostrService.js` to prevent network saturation. - Updated `scripts/check-hex.js` to exclude agent artifact directories (`perf/`, `test_logs/`, `context/`, etc.) to prevent lint failures when agents log code snippets or hex codes. - Increased `maxBuffer` in `scripts/check-hex.js` to 10MB to be robust against large matches. - Updated `js/services/exploreDataService.js` to trigger immediate data refresh (`refreshWatchHistoryTagCounts` and `refreshTagIdf`) when visibility state changes to visible, fixing a unit test failure. - Includes daily performance report and context logs. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
91ec9b32c5
commit
f1c83534d6
130 files changed
+5831
-7557
No files matched your search
+6
-22
@@ -12,8 +12,6 @@ import {
|
||||
assertAnyRelayAccepted,
|
||||
} from "./nostrPublish.js";
|
||||
import { profileCache } from "./state/profileCache.js";
|
||||
import { pMap } from "./utils/asyncUtils.js";
|
||||
import { RELAY_BACKGROUND_CONCURRENCY } from "./nostr/relayConstants.js";
|
||||
|
||||
const MODE_SEQUENCE = ["both", "read", "write"];
|
||||
|
||||
@@ -578,29 +576,15 @@ class RelayPreferencesManager {
|
||||
const fastPromises = fastRelays.map((relayUrl) =>
|
||||
fetchFromRelay(relayUrl, FAST_RELAY_TIMEOUT_MS, true)
|
||||
);
|
||||
const backgroundBatchPromise = pMap(
|
||||
backgroundRelays,
|
||||
async (relayUrl) => {
|
||||
try {
|
||||
const res = await fetchFromRelay(
|
||||
relayUrl,
|
||||
BACKGROUND_RELAY_TIMEOUT_MS,
|
||||
false
|
||||
);
|
||||
return { status: "fulfilled", value: res };
|
||||
} catch (error) {
|
||||
return { status: "rejected", reason: error };
|
||||
}
|
||||
},
|
||||
{ concurrency: RELAY_BACKGROUND_CONCURRENCY }
|
||||
const backgroundPromises = backgroundRelays.map((relayUrl) =>
|
||||
fetchFromRelay(relayUrl, BACKGROUND_RELAY_TIMEOUT_MS, false)
|
||||
);
|
||||
|
||||
const background = Promise.all([
|
||||
Promise.allSettled(fastPromises),
|
||||
backgroundBatchPromise,
|
||||
const background = Promise.allSettled([
|
||||
...fastPromises,
|
||||
...backgroundPromises,
|
||||
])
|
||||
.then(([fastOutcomes, backgroundOutcomes]) => {
|
||||
const outcomes = [...fastOutcomes, ...backgroundOutcomes];
|
||||
.then((outcomes) => {
|
||||
const aggregated = [];
|
||||
outcomes.forEach((outcome) => {
|
||||
if (outcome.status === "fulfilled") {
|
||||
|
||||
Reference in new issue
Block a user