mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-19 06:07:21 +02:00
perf: bound request work and resource usage (#866)
* perf: bound request work and resource usage * fix: address performance review regressions * fix: guard content expiration and dashboard state * fix: tolerate cache outages and retire derived paths * fix: revalidate expiration claims and status pagination * fix: retry interrupted repository metadata cleanup * fix: retire obsolete content cache storage * fix: activate tree metadata and recheck expiration claims * fix: fence cache publication across expiration * fix: recover staged trees and enforce cache lifecycle cleanup * fix: prune expired transforms during database outages * fix: finish conference removals and reload expiration candidates
This commit is contained in:
1 parent
32722169a2
commit
6434337923
74 files changed
+4752
-553
No files matched your search
+11
-6
@@ -19,14 +19,14 @@ export function createPageState(parent = null, events = new Map()) {
|
||||
});
|
||||
Object.defineProperty(own, "parent", { value: parent, configurable: true });
|
||||
Object.defineProperty(own, "viewState", { get: () => state });
|
||||
state.watch = (source, callback, deep = false) => {
|
||||
state.watch = (source, callback, deep = false, immediate = true) => {
|
||||
const read = typeof source === "function" ? () => source(state) : () => getPath(state, source);
|
||||
const stop = watch(read, callback, { deep, flush: "post" });
|
||||
cleanups.push(stop);
|
||||
nextTick(() => { if (!disposed) callback(read(), read()); });
|
||||
if (immediate) nextTick(() => { if (!disposed) callback(read(), read()); });
|
||||
return stop;
|
||||
};
|
||||
state.watchGroup = (sources, callback) => state.watch(() => sources.map(s => getPath(state, s)), callback, true);
|
||||
state.watchGroup = (sources, callback, immediate = true) => state.watch(() => sources.map(s => getPath(state, s)), callback, true, immediate);
|
||||
state.on = (name, callback) => {
|
||||
if (name === "dispose") { cleanups.push(callback); return () => {}; }
|
||||
if (!events.has(name)) events.set(name, new Set());
|
||||
@@ -69,10 +69,15 @@ export function createTimers() {
|
||||
}
|
||||
|
||||
export function createListeners() {
|
||||
const cleanups = [];
|
||||
onScopeDispose(() => cleanups.forEach(fn => fn()));
|
||||
const cleanups = new Set();
|
||||
onScopeDispose(() => { cleanups.forEach(fn => fn()); cleanups.clear(); });
|
||||
return (target, type, callback, options) => {
|
||||
target.addEventListener(type, callback, options);
|
||||
cleanups.push(() => target.removeEventListener(type, callback, options));
|
||||
const off = () => {
|
||||
target.removeEventListener(type, callback, options);
|
||||
cleanups.delete(off);
|
||||
};
|
||||
cleanups.add(off);
|
||||
return off;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user