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.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package render
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"evobgp/internal/store"
|
||||
)
|
||||
|
||||
// PublishLatestTenantRevision sets each speaker's published_revision_id to the newest tenant revision (by created_at).
|
||||
// Simplification for single-tenant / demo stacks; multi-module tenants may prefer explicit publish policies later.
|
||||
func PublishLatestTenantRevision(ctx context.Context, st store.Backend) {
|
||||
_ = ctx
|
||||
tenants, err := st.ListTenantIDs()
|
||||
if err != nil {
|
||||
log.Printf("evobgp-render: list tenants: %v", err)
|
||||
return
|
||||
}
|
||||
for _, tid := range tenants {
|
||||
revs, _, _ := st.ListRevisions(tid, "", "", 1)
|
||||
if len(revs) == 0 {
|
||||
continue
|
||||
}
|
||||
rid := revs[0].ID
|
||||
for _, sp := range st.ListSpeakersForTenant(tid) {
|
||||
if err := st.PublishRevisionForSpeaker(sp.ID, rid); err != nil {
|
||||
log.Printf("evobgp-render: publish speaker %s: %v", sp.ID, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user