mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
refactor(proxies): remove allconnections reactive for better performance
This commit is contained in:
parent
a7213df135
commit
bed4be6742
@ -12,7 +12,10 @@ type WsMsg = {
|
|||||||
// we make connections global, so we can keep track of connections when user in proxy page
|
// we make connections global, so we can keep track of connections when user in proxy page
|
||||||
// when user selects proxy and close some connections they can back and check connections
|
// when user selects proxy and close some connections they can back and check connections
|
||||||
// they closed
|
// they closed
|
||||||
const [allConnections, setAllConnections] = createSignal<Connection[]>([])
|
let allConnections: Connection[] = []
|
||||||
|
const setAllConnections = (allConns: Connection[]) => {
|
||||||
|
allConnections = allConns
|
||||||
|
}
|
||||||
|
|
||||||
export let latestConnectionMsg: Accessor<WsMsg> = () => ({
|
export let latestConnectionMsg: Accessor<WsMsg> = () => ({
|
||||||
uploadTotal: 0,
|
uploadTotal: 0,
|
||||||
@ -96,7 +99,7 @@ export function restructRawMsgToConnection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function mergeAllConnections(activeConns: Connection[]) {
|
export function mergeAllConnections(activeConns: Connection[]) {
|
||||||
return unionWith(allConnections(), activeConns, (a, b) => a.id === b.id)
|
return unionWith(allConnections, activeConns, (a, b) => a.id === b.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function diffClosedConnections(
|
function diffClosedConnections(
|
||||||
|
Loading…
Reference in New Issue
Block a user