hack around ignoring 'to' URIs that end in /followers
may remove the entire associated for-loop...
This commit is contained in:
parent
d02ae808a1
commit
81b06d64e8
@ -7,7 +7,7 @@ import (
|
||||
"html"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"io"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@ -143,12 +143,15 @@ func check_post(uri string) (PostJson, error) {
|
||||
|
||||
_, err = pool.Exec(context.Background(), "INSERT INTO posts (id, inreplyto, published, summary, content, normalized, attributedto, posthash, instance) VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)", postjson.ID, postjson.InReplyTo, postjson.Published, postjson.Summary, postjson.Content, postjson.normalized, postjson.AttributedTo, postjson.posthash, postjson.instance)
|
||||
if err != nil {
|
||||
// log.Print("INSERT posts error of " + uri + ": ", err)
|
||||
return postjson, err
|
||||
}
|
||||
|
||||
for _, to := range postjson.To {
|
||||
if to != "https://www.w3.org/ns/activitystreams#Public" && to != "" {
|
||||
if strings.HasSuffix(to, "/followers") == true {
|
||||
// This check is very much a bad solution, may consider removing the entire for-loop
|
||||
continue
|
||||
}
|
||||
go check_user(to)
|
||||
}
|
||||
}
|
||||
@ -191,7 +194,7 @@ func check_user(uri string) (UserJson, error) {
|
||||
return userjson, err
|
||||
}
|
||||
|
||||
io.Copy(ioutil.Discard, resp.Body)
|
||||
io.Copy(ioutil.Discard, resp.Body)
|
||||
|
||||
resp.Body.Close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user