removed goroutine for processing comments

This commit is contained in:
orangix 2023-08-15 22:22:17 +02:00
parent 1e74fe248e
commit 09e51174a0
No known key found for this signature in database
GPG Key ID: C31D4A86601C8416

View File

@ -134,21 +134,13 @@ func (client *Client) FetchUserComments(username string) ([]Comment, error) {
data := gjson.Parse(string(body))
wg := sync.WaitGroup{}
comments := make([]Comment, 0)
data.Get("data").ForEach(
func(key, value gjson.Result) bool {
wg.Add(1)
go func() {
defer wg.Done()
comments = append(comments, parseComment(value))
}()
comments = append(comments, parseComment(value))
return true
},
)
wg.Wait()
client.Cache.Set(username+"-usercomments", comments, cache.DefaultExpiration)
return comments, nil