feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
1 parent
aa6c3f50f4
commit
ceddfd3d6b
828 files changed
+122253
-13702
No files matched your search
+19
-2
@@ -131,13 +131,14 @@ func GetChannel(
|
||||
model string,
|
||||
retry int,
|
||||
filters []dto.ChannelFilter,
|
||||
traces ...*SelectionTrace,
|
||||
) (*Channel, error) {
|
||||
var abilities []Ability
|
||||
err := DB.Where(commonGroupCol+" = ? and model = ? and enabled = ?", group, model, true).Order("priority DESC, weight DESC").Find(&abilities).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
abilities = filterAbilitiesByConstraints(abilities, model, filters)
|
||||
abilities = filterAbilitiesByConstraints(abilities, model, filters, traces...)
|
||||
if len(abilities) > 0 {
|
||||
priorities := make([]int64, 0)
|
||||
seen := make(map[int64]bool)
|
||||
@@ -187,7 +188,7 @@ func GetChannel(
|
||||
// filterAbilitiesByConstraints applies the same ChannelSatisfiesFilters
|
||||
// predicate used by the memory-cache path. A failed channel lookup fails
|
||||
// closed when a task-plugin identity is required and fails open otherwise.
|
||||
func filterAbilitiesByConstraints(abilities []Ability, modelName string, filters []dto.ChannelFilter) []Ability {
|
||||
func filterAbilitiesByConstraints(abilities []Ability, modelName string, filters []dto.ChannelFilter, traces ...*SelectionTrace) []Ability {
|
||||
if len(abilities) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -218,6 +219,22 @@ func filterAbilitiesByConstraints(abilities []Ability, modelName string, filters
|
||||
filtered := make([]Ability, 0, len(abilities))
|
||||
for _, ability := range abilities {
|
||||
channel := channelsByID[ability.ChannelId]
|
||||
if len(traces) > 0 && traces[0] != nil {
|
||||
reason := "eligible"
|
||||
if ok, kind := ChannelSatisfiesFilters(channel, modelName, filters); !ok {
|
||||
reason = "excluded_" + string(kind)
|
||||
}
|
||||
traces[0].Add(channel, ability.ChannelId, ability.Group, modelName, reason)
|
||||
// DB routing uses the ability's priority and weight.
|
||||
if n := len(traces[0].Candidates); n > 0 && traces[0].Candidates[n-1].ChannelID == ability.ChannelId {
|
||||
candidate := &traces[0].Candidates[n-1]
|
||||
candidate.Weight = int(ability.Weight)
|
||||
candidate.Priority = 0
|
||||
if ability.Priority != nil {
|
||||
candidate.Priority = *ability.Priority
|
||||
}
|
||||
}
|
||||
}
|
||||
if ok, _ := ChannelSatisfiesFilters(channel, modelName, filters); ok {
|
||||
filtered = append(filtered, ability)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user