@@ -24,32 +24,8 @@ const proxyLatenciesReducer = (
24
24
state : Record < string , ProxyLatencyReport > ,
25
25
action : ProxyLatencyAction ,
26
26
) : Record < string , ProxyLatencyReport > => {
27
- // TODO: We should probably not read from local storage on every action.
28
- const history = loadStoredLatencies ( )
29
- const proxyHistory = history [ action . proxyID ] || [ ]
30
- const minReport = proxyHistory . reduce ( ( min , report ) => {
31
- if ( min . latencyMS === 0 ) {
32
- // Not yet set, so use the new report.
33
- return report
34
- }
35
- if ( min . latencyMS < report . latencyMS ) {
36
- return min
37
- }
38
- return report
39
- } , { } as ProxyLatencyReport )
40
-
41
- if (
42
- minReport . latencyMS > 0 &&
43
- minReport . latencyMS < action . report . latencyMS
44
- ) {
45
- // The new report is slower then the min report, so use the min report.
46
- return {
47
- ...state ,
48
- [ action . proxyID ] : minReport ,
49
- }
50
- }
51
-
52
- // Use the new report
27
+ // Always return the new report. We have some saved latencies, but until we have a better
28
+ // way to utilize them, we will ignore them for all practical purposes.
53
29
return {
54
30
...state ,
55
31
[ action . proxyID ] : action . report ,
@@ -65,7 +41,7 @@ export const useProxyLatency = (
65
41
proxyLatencies : Record < string , ProxyLatencyReport >
66
42
} => {
67
43
// maxStoredLatencies is the maximum number of latencies to store per proxy in local storage.
68
- let maxStoredLatencies = 8
44
+ let maxStoredLatencies = 1
69
45
// The reason we pull this from local storage is so for development purposes, a user can manually
70
46
// set a larger number to collect data in their normal usage. This data can later be analyzed to come up
71
47
// with some better magic numbers.
0 commit comments