Commit 7749b37
Make retriable request functions
At the time I wrote this code I didn't realize that plain `Fn` existed
and thought the only two options were `FnOnce` (which I couldn't use
since the function is called more than once) and the previously used
`FnMut`. This brought the problem that, because the function could
mutate state (which we never used outside of the tests), it had to be
wrapped in an `Arc<Mutex<_>>`, which was quite ugly.
This makes the tests a tad messier since they have to use synchronized
operations to keep track of the attempt count now, but it's not too bad
and isolated solely to the test code.
Signed-off-by: Ryan Gonzalez <[email protected]>Fn instead of FnMut
1 parent dc5787d commit 7749b37
1 file changed
+25
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
62 | 56 | | |
63 | 57 | | |
64 | 58 | | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
68 | 62 | | |
| 63 | + | |
| 64 | + | |
69 | 65 | | |
70 | 66 | | |
71 | 67 | | |
| |||
114 | 110 | | |
115 | 111 | | |
116 | 112 | | |
117 | | - | |
| 113 | + | |
118 | 114 | | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
122 | | - | |
| 118 | + | |
123 | 119 | | |
124 | 120 | | |
125 | 121 | | |
126 | 122 | | |
127 | 123 | | |
128 | | - | |
| 124 | + | |
129 | 125 | | |
130 | 126 | | |
131 | 127 | | |
| |||
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
141 | | - | |
| 137 | + | |
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
145 | 141 | | |
146 | | - | |
| 142 | + | |
147 | 143 | | |
148 | 144 | | |
149 | 145 | | |
| |||
155 | 151 | | |
156 | 152 | | |
157 | 153 | | |
158 | | - | |
| 154 | + | |
159 | 155 | | |
160 | 156 | | |
161 | 157 | | |
| |||
168 | 164 | | |
169 | 165 | | |
170 | 166 | | |
171 | | - | |
| 167 | + | |
172 | 168 | | |
173 | 169 | | |
174 | | - | |
| 170 | + | |
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
178 | 174 | | |
179 | | - | |
| 175 | + | |
180 | 176 | | |
181 | 177 | | |
182 | 178 | | |
| |||
189 | 185 | | |
190 | 186 | | |
191 | 187 | | |
192 | | - | |
| 188 | + | |
193 | 189 | | |
194 | 190 | | |
195 | | - | |
| 191 | + | |
196 | 192 | | |
197 | 193 | | |
198 | 194 | | |
| |||
203 | 199 | | |
204 | 200 | | |
205 | 201 | | |
206 | | - | |
| 202 | + | |
207 | 203 | | |
208 | 204 | | |
0 commit comments