Skip to content

Commit 3448ebc

Browse files
committed
Merge branch 'main' into demo
2 parents c2f7f60 + 560b6e0 commit 3448ebc

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

server/pkg/utils/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ func GetFormedHttpClient(request models.Request) (*http.Client, error) {
7979
Transport: tr,
8080
Timeout: time.Second * 10,
8181
Jar: jar,
82+
CheckRedirect: func(req *http.Request, via []*http.Request) error {
83+
return http.ErrUseLastResponse
84+
},
8285
}, nil
8386
}
8487

ui/src/pages/Request/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Spinner from "../../components/Spinner";
1515
import { StatFields } from "../../constants/request.const";
1616
import { Animate } from "../../components/Stats/Animation";
1717
import { getLatencyOptions, getRps } from "../../utils/chartOption";
18+
import { convertToMilliSeconds } from "../../utils/_shared";
1819

1920
function RPSChart({ servers }: { servers: Record<string, ServerMapData> }) {
2021
const getRPSOption = getRps(servers);
@@ -74,9 +75,9 @@ function Request({ requestId }: { requestId: string }) {
7475
<Stat borderRight="1px solid #e2e8f0" mr={2}>
7576
<StatLabel>Min-Max latency</StatLabel>
7677
<StatNumber>
77-
<Animate value={data.minLatency} />
78+
<Animate value={convertToMilliSeconds(data.minLatency)} />
7879
-
79-
<Animate value={data.maxLatency} /> ms
80+
<Animate value={convertToMilliSeconds(data.maxLatency)} /> ms
8081
</StatNumber>
8182
</Stat>
8283
</>

ui/src/utils/_shared.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ export const NumberFormat = (value: number) => {
44
maximumFractionDigits: 1,
55
}).format(value);
66
};
7+
8+
export const convertToMilliSeconds = (value) => {
9+
if (value > 0) {
10+
return Math.ceil(value / 1000);
11+
}
12+
return value;
13+
};

ui/src/utils/chartOption.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
LoadsterResponse,
44
ServerMapData,
55
} from "../store/stress/dashboard/types";
6+
import { convertToMilliSeconds } from "./_shared";
67

78
const getGridOptions = (options = {}) => {
89
return {
@@ -61,7 +62,7 @@ export function getLatencyOptions(latency: LoadsterResponse[]) {
6162
grid: getGridOptions(),
6263
series: keyToMap.map((key) => ({
6364
name: key,
64-
data: latency?.map((item) => item[key]?.toFixed()),
65+
data: latency?.map((item) => convertToMilliSeconds(item[key])),
6566
type: "line",
6667
})),
6768
};

0 commit comments

Comments
 (0)