fix(connections): close conns

This commit is contained in:
Zephyruso 2023-09-08 13:53:08 +08:00
parent b7b9688c9e
commit f3423abe92

View File

@ -47,7 +47,7 @@ const setProxiesInfo = (proxies: (Proxy | ProxyNode)[]) => {
export const useProxies = () => { export const useProxies = () => {
const request = useRequest() const request = useRequest()
const { activeConnectionsWithSpeed } = useConnections() const { activeConnections } = useConnections()
const updateProxies = async () => { const updateProxies = async () => {
const [{ providers }, { proxies }] = await Promise.all([ const [{ providers }, { proxies }] = await Promise.all([
@ -83,7 +83,7 @@ export const useProxies = () => {
const proxyGroup = proxyGroupList.find((i) => i.name === proxy.name)! const proxyGroup = proxyGroupList.find((i) => i.name === proxy.name)!
if (autoCloseConns()) { if (autoCloseConns()) {
activeConnectionsWithSpeed().forEach(({ id, chains }) => { activeConnections().forEach(({ id, chains }) => {
if (chains.includes(proxy.name)) { if (chains.includes(proxy.name)) {
request.delete(`connections/${id}`) request.delete(`connections/${id}`)
} }