Commit 9696d9d
committed
Add additional logging to subscribe route and simplify calling
Out-of-band discussions with the BitCraft team
brought up questions about whether it was possible for a rejected client connection
to start an expensive computation like a subscription before their connection was killed,
e.g. by sending a `Subscribe` message along the WebSocket
before `client_connected` had finished returning `Err`.
I don't believe this was actually possible,
as `ClientConnection::spawn` called and awaited `call_identity_connected`
before invoking its `actor` closure,
and it was that `actor` which processed `Subscribe` messages.
But it was somewhat difficult to verify that behavior,
and so I re-organized the code so that the outer layer of the `subscribe` handler
obviously had that property without having to step into `ClientConnection::spawn`.
I also added some additional logging to the subscribe route,
including the `X-Forwarded-For` header in more messages,
as the BitCraft team complained about having difficulty correlating IP addresses with connections.
The log levels remain the same as before, just with additional information added:
- Successful connections are at `debug` level,
- Rejected connections are at `info` level
(these are the ones BitCraft cares about in this case).
- Failed connections are at `warn`.
As the levels are unchanged, this should not add undesirable log noise.client_connected
1 parent e214f73 commit 9696d9d
2 files changed
Lines changed: 43 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
| 172 | + | |
172 | 173 | | |
173 | | - | |
| 174 | + | |
174 | 175 | | |
175 | | - | |
176 | | - | |
| 176 | + | |
| 177 | + | |
177 | 178 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
182 | 183 | | |
183 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
187 | | - | |
| 190 | + | |
188 | 191 | | |
189 | 192 | | |
190 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
| |||
200 | 210 | | |
201 | 211 | | |
202 | 212 | | |
203 | | - | |
| 213 | + | |
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
397 | 414 | | |
398 | 415 | | |
399 | 416 | | |
400 | 417 | | |
401 | 418 | | |
402 | 419 | | |
403 | | - | |
| 420 | + | |
404 | 421 | | |
405 | 422 | | |
406 | 423 | | |
| |||
409 | 426 | | |
410 | 427 | | |
411 | 428 | | |
412 | | - | |
413 | 429 | | |
414 | 430 | | |
415 | 431 | | |
| |||
455 | 471 | | |
456 | 472 | | |
457 | 473 | | |
458 | | - | |
| 474 | + | |
459 | 475 | | |
460 | 476 | | |
461 | 477 | | |
| |||
0 commit comments