Commit ed12302
Make GitHub token refresh threshold configurable
The hardcoded 300-second (5-minute) refresh threshold was causing the
github-token-refresh test to fail. With a 2-second token lifetime, fresh
tokens were immediately considered "expiring" (2s < 300s threshold),
triggering unnecessary refreshes on every getClient() call.
Changes:
- Add githubTokenRefreshThresholdSeconds to Settings (default: 300)
- Read TASKRUNNER_GITHUB_TOKEN_REFRESH_THRESHOLD_SECONDS env var
- Use configurable threshold in getClient and loadOrRefreshClient
- Set threshold to 1 second in github-token-refresh test
This allows the test to verify proper token refresh behavior:
- Fresh tokens (2s remaining >= 1s threshold) are reused
- Expired tokens trigger refresh
- Test now passes with 2 token requests instead of 4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 7bd8cda commit ed12302
File tree
4 files changed
+8
-2
lines changed- src
- test/t/slow
4 files changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | | - | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
0 commit comments