aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-10-04 19:27:54 -0700
committerFChannel <>2021-10-04 19:27:54 -0700
commit4802b91fe62eb28512b7f6c602d40f807bcbd33f (patch)
treec381b4826866a09e639ef02de26b1973b6762fd5
parent1d8f957248c084773b235919be17d238be36ae01 (diff)
fix for instance index with empty actor id
-rw-r--r--main.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/main.go b/main.go
index 68d8a4f..8deedd4 100644
--- a/main.go
+++ b/main.go
@@ -2778,27 +2778,31 @@ func AddInstanceToIndex(actor string) {
func AddInstanceToIndexDB(db *sql.DB, actor string) {
+ //sleep to be sure the webserver is fully initialized
+ //before making finger request
time.Sleep(15 * time.Second)
+ nActor := FingerActor(actor)
+
+ if nActor.Id == "" {
+ return
+ }
+
followers := GetCollectionFromID("https://fchan.xyz/followers")
var alreadyIndex = false
for _, e := range followers.Items {
- if e.Id == actor {
+ if e.Id == nActor.Id {
alreadyIndex = true
}
}
- checkActor := GetActor(actor)
-
- if checkActor.Id == actor {
- if !alreadyIndex {
- query := `insert into follower (id, follower) values ($1, $2)`
+ if !alreadyIndex {
+ query := `insert into follower (id, follower) values ($1, $2)`
- _, err := db.Exec(query, "https://fchan.xyz", actor)
+ _, err := db.Exec(query, "https://fchan.xyz", nActor.Id)
- CheckError(err, "Error with add to index query")
- }
+ CheckError(err, "Error with add to index query")
}
}