quality / commitlint (push) Skipped
quality / changes (push) Successful in 9s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 46s
quality / web (push) Successful in 1m16s
quality / go (push) Successful in 2m42s
quality / bird2 (push) Successful in 16s
CD / quality (push) Successful in 5m19s
CD / publish (push) Successful in 7m19s
- Deleted unused components: `DashboardActivityTimeline`, `DashboardFramePanel`, `DashboardModulesGrid`, `DashboardRecentJobsGrid`, and `DashboardRecentRevisionsGrid` to streamline the dashboard. - Updated `DashboardKpiGrid` to improve KPI display logic, including progress indicators and enhanced badge functionality. - Refactored `DashboardNetworkHealth` to provide better status representation based on loading states and network conditions. - Introduced new properties for KPI cards to support progress tracking and improved visual feedback. This cleanup aims to enhance performance and maintainability of the dashboard while providing a better user experience.
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package pipeline
|
|
|
|
import (
|
|
"hash/fnv"
|
|
"time"
|
|
|
|
"evobgp/internal/store"
|
|
)
|
|
|
|
// SchedulerTickSec matches the scheduler ticker interval (internal/scheduler).
|
|
const SchedulerTickSec = 30
|
|
|
|
// ModuleDueForScheduler reports whether a module's refresh interval bucket rolled since the last scheduler tick.
|
|
// A stable per-module offset (fnv32 of ID) spreads bucket boundaries so modules with the same interval
|
|
// do not all become due on the same tick (thundering herd).
|
|
func ModuleDueForScheduler(mod *store.Module, now time.Time) bool {
|
|
if mod == nil || !mod.Enabled || mod.Type == "IP_RANGES" || mod.RefreshIntervalSec <= 0 {
|
|
return false
|
|
}
|
|
win := int64(mod.RefreshIntervalSec)
|
|
if win < 60 {
|
|
win = 60
|
|
}
|
|
offset := moduleSchedulerOffset(mod.ID, win)
|
|
cur := (now.Unix() - offset) / win
|
|
prev := (now.Unix() - offset - SchedulerTickSec) / win
|
|
return cur != prev
|
|
}
|
|
|
|
func moduleSchedulerOffset(moduleID string, win int64) int64 {
|
|
if win <= 0 {
|
|
return 0
|
|
}
|
|
return int64(fnv32a(moduleID) % uint32(win))
|
|
}
|
|
|
|
func fnv32a(s string) uint32 {
|
|
h := fnv.New32a()
|
|
_, _ = h.Write([]byte(s))
|
|
return h.Sum32()
|
|
}
|