Fixed benchmarks
This commit is contained in:
parent
c090b6970c
commit
7e07923177
@ -10,11 +10,11 @@ import (
|
|||||||
func BenchmarkRenderThread(b *testing.B) {
|
func BenchmarkRenderThread(b *testing.B) {
|
||||||
thread, _ := arn.GetThread("HJgS7c2K")
|
thread, _ := arn.GetThread("HJgS7c2K")
|
||||||
thread.HTML() // Pre-render markdown
|
thread.HTML() // Pre-render markdown
|
||||||
|
replies := thread.Posts()
|
||||||
|
|
||||||
replies, _ := arn.FilterPosts(func(post *arn.Post) bool {
|
for _, reply := range replies {
|
||||||
post.HTML() // Pre-render markdown
|
reply.HTML() // Pre-render markdown
|
||||||
return post.ThreadID == thread.ID
|
}
|
||||||
})
|
|
||||||
|
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/animenotifier/arn"
|
|
||||||
"github.com/fatih/color"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
color.Yellow("Updating post structure")
|
|
||||||
|
|
||||||
defer color.Green("Finished.")
|
|
||||||
defer arn.Node.Close()
|
|
||||||
|
|
||||||
// Iterate over the stream
|
|
||||||
for post := range arn.StreamPosts() {
|
|
||||||
post.ParentID = post.ThreadID
|
|
||||||
post.ParentType = "Thread"
|
|
||||||
post.Save()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user