diff options
author | FChannel <> | 2021-10-04 20:13:00 -0700 |
---|---|---|
committer | FChannel <> | 2021-10-04 20:13:00 -0700 |
commit | e490998c196e5c7a64e8903a500078f5c98e3dad (patch) | |
tree | 6efb333b5d2e58c6e8ac5ee21fa9850807a34862 /main.go | |
parent | 51b00e294280b44010736f9afd4b250e9a372340 (diff) | |
parent | 36c63daa85818488055edf8ae63af58058e4efb2 (diff) |
Merge branch 'development'
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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") } } |