refactor: update worker processes in EvoBGP to accept dependencies for shared store and job registry. Enhance scheduler, ingest, render, and deploy components to utilize a unified context and improve logging for drift detection. Update architecture documentation to reflect changes in process interactions and worker functionalities.
CI / changes (push) Successful in 5s
CI / go (push) Failing after 9s
CI / openapi (push) Has been skipped
CI / bird2 (push) Has been skipped

This commit is contained in:
Denozordec
2026-04-05 17:42:07 +07:00
parent 5d21f013cf
commit b7968db4e0
22 changed files with 936 additions and 77 deletions
+33 -4
View File
@@ -1,22 +1,51 @@
// Package ingest fetches CDN lists, resolves DoH domains, and writes normalized prefixes into the database.
package ingest
import (
"context"
"log"
"net/http"
"time"
"evobgp/internal/broker"
"evobgp/internal/config"
"evobgp/internal/pipeline"
"evobgp/internal/store"
)
// Run blocks until ctx is cancelled. Reference deployment: separate process consuming the job queue.
func Run(ctx context.Context) {
// Deps runs lightweight CDN ETag prefetch against the shared store.
type Deps struct {
Store store.Backend
}
// Run blocks until ctx is cancelled.
func Run(ctx context.Context, deps *Deps) {
cfg := config.Load()
broker.LogConnect(ctx, cfg.BrokerURL)
if deps == nil || deps.Store == nil {
runStub(ctx)
return
}
hc := &http.Client{Timeout: 45 * time.Second}
t := time.NewTicker(60 * time.Second)
defer t.Stop()
log.Printf("evobgp-ingest: started (stub; ingest workers dequeue from broker or job_audit)")
log.Printf("evobgp-ingest: active (CDN conditional GET / ETag prefetch)")
for {
select {
case <-ctx.Done():
log.Printf("evobgp-ingest: stopped")
return
case <-t.C:
if err := pipeline.PrefetchCDNSourceETags(context.Background(), deps.Store, hc); err != nil {
log.Printf("evobgp-ingest: prefetch: %v", err)
}
}
}
}
func runStub(ctx context.Context) {
t := time.NewTicker(60 * time.Second)
defer t.Stop()
log.Printf("evobgp-ingest: idle stub (no store in Deps)")
for {
select {
case <-ctx.Done():