Commit a1e0933
authored
fix: reduce sync worker ticker period to 5m to prevent threshold drift at minimum sync interval (#4023)
## Summary
The sync worker ticker period was set to 1 hour, which created a subtle scheduling bug: when `pricingSyncInterval` is set near the minimum supported value, the few seconds a sync takes to complete causes the next ticker wake-up to land just under the elapsed-time threshold, effectively doubling the actual sync cadence. Reducing the ticker period to 5 minutes ensures the check granularity stays well below the minimum supported `pricingSyncInterval`, preventing ticker drift from defeating the threshold check.
## Changes
- Reduced `syncWorkerTickerPeriod` from 1 hour to 5 minutes so that ticker drift (caused by sync execution time) does not push the next wake-up just under the `pricingSyncInterval` threshold and inadvertently double the effective sync interval.
- Updated the scheduling model comment to accurately describe the relationship between the ticker period and `pricingSyncInterval`, removing the outdated note that implied the 1-hour ticker was a hard lower bound on sync frequency.
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI
## Affected areas
- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs
## How to test
```sh
go test ./framework/modelcatalog/...
```
Set `pricingSyncInterval` to a value near `MinimumPricingSyncIntervalSec` and verify that syncs occur at the expected cadence without doubling.
## Screenshots/Recordings
N/A
## Breaking changes
- [ ] Yes
- [x] No
## Related issues
N/A
## Security considerations
None.
## Checklist
- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Bug Fixes**
* Increased frequency of pricing synchronization checks from hourly intervals to 5-minute intervals, improving update timeliness and overall system reliability across different configurations.
* **Documentation**
* Updated internal documentation clarifying the pricing synchronization scheduling mechanism and how timing parameters influence sync behavior.
<!-- review_stack_entry_start -->
[](https://app.coderabbit.ai/change-stack/maximhq/bifrost/pull/4023?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 2c0e7cf commit a1e0933
2 files changed
Lines changed: 10 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
250 | 247 | | |
251 | 248 | | |
252 | 249 | | |
| |||
0 commit comments