debug info to importer

This commit is contained in:
Umputun
2017-12-29 00:17:28 -06:00
parent 88d692aeaf
commit 0464452088
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -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
+1 -1
View File
@@ -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 {