mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 09:15:33 +00:00
BUGFIX: race condition in engine; index page controller
This commit is contained in:
@@ -42,7 +42,7 @@ func Iterate[T any](xmlData string, initialState T) iter.Seq2[*TokenResult[T], e
|
||||
decoder := xml.NewDecoder(strings.NewReader(xmlData))
|
||||
stack := []Element{}
|
||||
state := initialState
|
||||
return iter.Seq2[*TokenResult[T], error](func(yield func(*TokenResult[T], error) bool) {
|
||||
return func(yield func(*TokenResult[T], error) bool) {
|
||||
for {
|
||||
token, err := decoder.Token()
|
||||
if err == io.EOF {
|
||||
@@ -117,7 +117,7 @@ func Iterate[T any](xmlData string, initialState T) iter.Seq2[*TokenResult[T], e
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// mapAttributes converts xml.Attr to a map[string]string.
|
||||
|
||||
@@ -134,9 +134,8 @@ func (p *XMLParser[T]) addResolvable(item T) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *XMLParser[T]) ReverseLookup(item IXMLItem) []Resolved[T] {
|
||||
func (p *XMLParser[T]) ReverseLookup(item IXMLItem) (ret []Resolved[T]) {
|
||||
// INFO: this runs just once for the first key
|
||||
ret := make([]Resolved[T], 0)
|
||||
keys := item.Keys()
|
||||
|
||||
for _, key := range keys {
|
||||
@@ -146,17 +145,16 @@ func (p *XMLParser[T]) ReverseLookup(item IXMLItem) []Resolved[T] {
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
return
|
||||
}
|
||||
|
||||
func (a *XMLParser[T]) String() string {
|
||||
func (a *XMLParser[T]) String() (s string) {
|
||||
a.RLock()
|
||||
defer a.RUnlock()
|
||||
var s string
|
||||
for _, item := range a.array {
|
||||
s += item.String()
|
||||
}
|
||||
return s
|
||||
return
|
||||
}
|
||||
|
||||
func (p *XMLParser[T]) Info(id string) ItemInfo {
|
||||
|
||||
Reference in New Issue
Block a user