Commit 4799eef
committed
Separate backoff strategies for peer registration vs login operations
The previous implementation used a single 10 second backoff for both
registration and login operations. However, these are fundamentally
different operations with different timeout requirements:
Registration (new peer creation) legitimately needs longer timeouts
because it involves database writes, external IdP validation, and group
membership calculations. Login (existing peer authentication) is faster
and should fail quickly to provide actionable feedback to users.
This change:
- Auto-detects operation type by checking for SetupKey or JwtToken in the request
- Uses 180s timeout for registration (5s initial, 30s max interval)
- Uses 45s timeout for login (3s initial, 15s max interval)
- Extracts backoff creation into helper functions to keep login() complexity low
- Maintains backward compatibility - no API changes to public methods
The auto-detection approach eliminates the need for boolean parameters
and keeps the login() function simple while providing appropriate
timeouts for each scenario.1 parent aca0398 commit 4799eef
File tree
1 file changed
+61
-5
lines changed1 file changed
+61
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
312 | 322 | | |
313 | 323 | | |
314 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
315 | 357 | | |
316 | 358 | | |
317 | 359 | | |
| |||
334 | 376 | | |
335 | 377 | | |
336 | 378 | | |
337 | | - | |
338 | | - | |
339 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
340 | 388 | | |
341 | 389 | | |
342 | 390 | | |
343 | 391 | | |
344 | 392 | | |
345 | 393 | | |
346 | 394 | | |
347 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
348 | 404 | | |
349 | 405 | | |
350 | 406 | | |
| |||
0 commit comments