You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validates individual user connections in batches of 100, prioritising those never checked or longest overdue. Each check has a 15-second timeout.
29
+
Validates individual user connections in batches of 100 on a fixed ticker, prioritising those never checked or longest overdue. Each check has a 15-second timeout. A shared `http.Client` is reused across checks for connection pooling.
30
30
31
31
| Auth Type | Check Method |
32
32
|-----------|-------------|
33
-
|`oauth2`| Attempt a background token refresh |
34
-
|`api_key` / `basic_auth`| Decrypt credential, make a `GET` to `user_info_endpoint`|
33
+
|`oauth2`| Attempt a background token refresh via `ConnectionService.Refresh`|
34
+
|`api_key`| Decrypt credential, extract `api_key` field, `GET` to `user_info_endpoint` using provider's configured `AuthHeader`|
35
+
|`basic_auth`| Decrypt credential, extract `username`/`password`, `GET` to `user_info_endpoint` with `Authorization: Basic`|
35
36
| No endpoint configured | Mark `unknown`|
36
37
37
-
**Provider shielding:**if a refresh or API call fails, the worker cross-references the upstream provider's `health_status` before taking action. If the provider is `unhealthy` or `degraded`, the connection is marked `unhealthy` (retriable) rather than `expired` (terminal). This prevents mass-expiration of valid connections during transient upstream outages.
38
+
**OAuth2 status code handling:**The worker inspects `RefreshResponse.StatusCode` to distinguish definitive credential errors from transient failures:
38
39
39
-
| Outcome |`health_status` set |`status` changed? |
**Provider shielding:** Before expiring a connection, the worker cross-references the upstream provider's `health_status`. If the provider is `unhealthy` or `degraded`, the connection is marked `unhealthy` (retriable) instead of `expired` (terminal). This prevents mass-expiration during transient upstream outages.
49
+
50
+
**Error handling:** If `UpdateStatus` fails when expiring a connection, the worker logs the error and skips the `health_status` write to avoid leaving the connection in an inconsistent state.
45
51
46
52
**Concurrency:** max 20 connections checked concurrently (semaphore + WaitGroup).
47
53
@@ -54,9 +60,9 @@ Both `provider_profiles` and `connections` share the same status vocabulary:
54
60
| Value | Meaning |
55
61
|-------|---------|
56
62
|`healthy`| Last check passed |
57
-
|`unhealthy`| Last check failed — retriable |
58
-
|`degraded`|Check passed but with unexpected behavior|
59
-
|`expired`| Credential confirmed invalid — user must re-authenticate |
63
+
|`unhealthy`| Last check failed — retriable (transient upstream or provider-shielded) |
64
+
|`degraded`|Partial failure — scope issues, network errors, or internal errors where credential validity is unknown|
65
+
|`expired`| Credential confirmed invalid (400/401) — user must re-authenticate |
60
66
|`unknown`| Not yet checked, or not enough information to check |
0 commit comments