assure that index.json doesn't hold the lock too long
Dieterbe opened this issue · 2 comments
Dieterbe commented
e.g. /metrics/index.json - this can get very significant on multi-tenant instances ; i would be curious for a quick test actually with some fake metrics data
func (m *UnpartitionedMemoryIdx) List(orgId uint32) []idx.Archive {
pre := time.Now()
bc := m.RLockLow()
defer bc.RUnlockLow("List", nil)
defs := make([]idx.Archive, 0)
for _, def := range m.defById {
if def.OrgId == orgId || def.OrgId == idx.OrgIdPublic {
defs = append(defs, CloneArchive(def))
}
}
statListDuration.Value(time.Since(pre))
return defs
}
fkaleo commented
@robert-milan to have a look and try to solve it unless the resulting code is too complex.
stale commented
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.