debug info to importer
This commit is contained in:
@@ -76,7 +76,7 @@ func (d *Disqus) convert(r io.Reader, siteID string) (ch chan store.Comment) {
|
||||
|
||||
inpThreads, inpComments := 0, 0
|
||||
go func() {
|
||||
commentsCount := 0
|
||||
commentsCount, spamComments := 0, 0
|
||||
for {
|
||||
t, err := decoder.Token()
|
||||
if t == nil || err != nil {
|
||||
@@ -100,6 +100,7 @@ func (d *Disqus) convert(r io.Reader, siteID string) (ch chan store.Comment) {
|
||||
continue
|
||||
}
|
||||
if comment.IsSpam {
|
||||
spamComments++
|
||||
continue
|
||||
}
|
||||
c := store.Comment{
|
||||
@@ -126,7 +127,8 @@ func (d *Disqus) convert(r io.Reader, siteID string) (ch chan store.Comment) {
|
||||
}
|
||||
}
|
||||
close(commentsCh)
|
||||
log.Printf("[INFO] converted %d posts with %d comments from disqus %d/%d", len(postsMap), commentsCount, inpThreads, inpComments)
|
||||
log.Printf("[INFO] converted %d posts with %d comments from disqus %d/%d, spam %d",
|
||||
len(postsMap), commentsCount, inpThreads, inpComments, spamComments)
|
||||
}()
|
||||
|
||||
return commentsCh
|
||||
|
||||
@@ -117,7 +117,7 @@ func GetUserInfo(r *http.Request) (user store.User, err error) {
|
||||
|
||||
ctx := r.Context()
|
||||
if ctx == nil {
|
||||
return store.User{}, errors.New("user not defined")
|
||||
return store.User{}, errors.New("no info about user")
|
||||
}
|
||||
|
||||
if u, ok := ctx.Value(contextKey("user")).(store.User); ok {
|
||||
|
||||
Reference in New Issue
Block a user