perf: optimize data path, indexes and frontend virtualization
- Убран latestCDNRowsBySource; expanded BIRD preview генерируется on-demand - Batch AS meta updates; миграция perf-индексов 000012 - VirtualPrefixList для preview префиксов; метрики pipeline refresh - PolitePause для RIPEstat после cache miss Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -325,6 +325,38 @@ func (p *Postgres) UpdateASEntryResolveMeta(tenantID, moduleID, entryID string,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Postgres) UpdateASEntryResolveMetaBatch(tenantID, moduleID string, updates []store.ASEntryResolveMetaUpdate, resolvedAt time.Time) error {
|
||||
if len(updates) == 0 {
|
||||
return nil
|
||||
}
|
||||
if _, err := p.GetModule(tenantID, moduleID); err != nil {
|
||||
return err
|
||||
}
|
||||
ctx := context.Background()
|
||||
batch := &pgx.Batch{}
|
||||
for _, u := range updates {
|
||||
var nameArg any
|
||||
sn := strings.TrimSpace(u.ASNName)
|
||||
if sn == "" {
|
||||
nameArg = nil
|
||||
} else {
|
||||
nameArg = sn
|
||||
}
|
||||
batch.Queue(`
|
||||
UPDATE module_as_entry SET asn_name=$3, prefix_count=$4, asn_resolved_at=$5, updated_at=now()
|
||||
WHERE id=$1 AND module_id=$2`,
|
||||
u.EntryID, moduleID, nameArg, u.PrefixCount, resolvedAt.UTC())
|
||||
}
|
||||
br := p.pool.SendBatch(ctx, batch)
|
||||
defer func() { _ = br.Close() }()
|
||||
for range updates {
|
||||
if _, err := br.Exec(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Postgres) DeleteASEntry(tenantID, moduleID, entryID string) error {
|
||||
if _, err := p.GetModule(tenantID, moduleID); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user