Commit 2759e3f
authored
removed time.sleep and using ticker instead (kubernetes-sigs#648)
* removed time.sleep and using ticker instead
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
* move ticker creation outside of go routine.
make sure refresh internal is valid at the ticker creation time
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
* add DefaultRefreshPrometheusMetricsInterval for test purposes.
once ticker was introduced instead of sleep, having 0 as the refresh internal is not valid.
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
* wait in test until metrics are available before running tests that rely on the values.
up until now, the metrics go routine ran in tests with time.Sleep(0), which means metrics were avaiable immediately.
while in tests in might be acceptable to wait few seconds using sleep, in the actual code (not tests) it's a bad practice to use
sleep which was replaced with a ticker (to perform periodic task in an endless loop).
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
---------
Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>1 parent 81100ff commit 2759e3f
File tree
4 files changed
+16
-14
lines changed- pkg/epp
- backend/metrics
- server
- test/integration/epp
4 files changed
+16
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
94 | 99 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1548 | 1548 | | |
1549 | 1549 | | |
1550 | 1550 | | |
| 1551 | + | |
| 1552 | + | |
1551 | 1553 | | |
1552 | 1554 | | |
1553 | 1555 | | |
| |||
0 commit comments