1- import { getRandomItems } from "./../utils/index" ;
2- import { CfIpResponse } from "../components/TestPage" ;
1+ import { getRandomItems } from "@/utils/index" ;
32import axios from "axios" ;
43import { from , mergeMap } from "rxjs" ;
5- import { CfIpListV4 } from ".. /constants/CfIpListV4" ;
4+ import { CfIpListV4 } from "@ /constants/CfIpListV4" ;
65import urlParse from "url-parse" ;
76import { round } from "lodash-es" ;
7+ import { CfIpResponse } from "@/screens/TestRunScreen/model" ;
88const getTargetUrlConfig = ( ip : string , testUrl : string ) => {
99 const oldUrl = urlParse ( testUrl , true ) ;
1010 const newUrl = urlParse ( testUrl , true ) ;
@@ -63,7 +63,6 @@ const getCfNodeResponseTestTime = async (ip: string, testUrl: string) => {
6363 const result : CfIpResponse = {
6464 ip,
6565 meanRespond : 0 ,
66- hasError : false ,
6766 responseTestStatus : "PENDING" ,
6867 } ;
6968 try {
@@ -74,7 +73,6 @@ const getCfNodeResponseTestTime = async (ip: string, testUrl: string) => {
7473 } catch ( error ) {
7574 console . log ( error , "response error" ) ;
7675
77- result . hasError = true ;
7876 result . responseTestStatus = "ERROR" ;
7977 }
8078 return result ;
@@ -84,7 +82,6 @@ const getCfNodeDownloadTestTime = async (ip: string, testUrl: string) => {
8482 const result : CfIpResponse = {
8583 ip,
8684 meanDownloadSpeed : 0 ,
87- hasError : false ,
8885 speedTestStatus : "PENDING" ,
8986 } ;
9087 try {
@@ -97,7 +94,6 @@ const getCfNodeDownloadTestTime = async (ip: string, testUrl: string) => {
9794 result . meanDownloadSpeed = round ( fileSize / time , 2 ) ;
9895 } catch ( error ) {
9996 console . log ( "download fail" , error ) ;
100- result . hasError = true ;
10197 result . speedTestStatus = "ERROR" ;
10298 }
10399 return result ;
@@ -127,4 +123,4 @@ export const getCfNodesDownloadTestTime = (
127123export const getRandomCfIpList = ( totalCount : number ) => {
128124 const ipList = getRandomItems ( CfIpListV4 , totalCount ) ;
129125 return ipList ;
130- } ;
126+ } ;
0 commit comments