mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-07-20 09:58:23 +00:00
removed goroutine for processing comments
This commit is contained in:
parent
1e74fe248e
commit
09e51174a0
@ -134,21 +134,13 @@ func (client *Client) FetchUserComments(username string) ([]Comment, error) {
|
|||||||
|
|
||||||
data := gjson.Parse(string(body))
|
data := gjson.Parse(string(body))
|
||||||
|
|
||||||
wg := sync.WaitGroup{}
|
|
||||||
comments := make([]Comment, 0)
|
comments := make([]Comment, 0)
|
||||||
data.Get("data").ForEach(
|
data.Get("data").ForEach(
|
||||||
func(key, value gjson.Result) bool {
|
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
|
return true
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
wg.Wait()
|
|
||||||
|
|
||||||
client.Cache.Set(username+"-usercomments", comments, cache.DefaultExpiration)
|
client.Cache.Set(username+"-usercomments", comments, cache.DefaultExpiration)
|
||||||
return comments, nil
|
return comments, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user