Batch discord data to 20 locations at a time

This commit is contained in:
Daniel Mason 2021-09-02 09:37:06 +12:00
parent fdad4bffbb
commit 4c283f1cbb
Signed by: idanoo
GPG key ID: 387387CDBC02F132
2 changed files with 14 additions and 6 deletions

View file

@ -42,13 +42,15 @@ func postTheUpdates() {
// Discord
postableDiscordData := getPostableDiscordData()
if postableDiscordData == "" {
if len(postableDiscordData) == 0 {
return
}
// Not using go routines so we don't get rate limited
for _, discordWebhook := range DiscordWebhooks {
postToDiscord(discordWebhook, postableDiscordData)
for _, postableData := range postableDiscordData {
go postToDiscord(discordWebhook, postableData)
time.Sleep(1 * time.Second)
}
}
// Clear out posted data!