Michael Kaye
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
3 deletions
-
go.mod
-
services/rssbot/rssbot.go
|
|
@ -51,5 +51,5 @@ require ( |
|
|
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect |
|
|
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect |
|
|
|
gopkg.in/yaml.v2 v2.3.0 |
|
|
|
maunium.net/go/mautrix v0.7.0 |
|
|
|
maunium.net/go/mautrix v0.9.2 |
|
|
|
) |
|
|
@ -215,7 +215,10 @@ func (s *Service) OnPoll(cli types.MatrixClient) time.Time { |
|
|
|
"feed_url": u, |
|
|
|
log.ErrorKey: err, |
|
|
|
"item": item, |
|
|
|
}).Error("Failed to send item to room") |
|
|
|
}).Error("Failed to send item to room due to 429; aborting further sends") |
|
|
|
// no point continuing if we errored due to a 429 - we'll just hit the rate limit
|
|
|
|
// again and again
|
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -415,7 +418,11 @@ func (s *Service) sendToRooms(cli types.MatrixClient, feedURL string, feed *gofe |
|
|
|
logger.Info("Sending new feed item") |
|
|
|
for _, roomID := range s.Feeds[feedURL].Rooms { |
|
|
|
if _, err := cli.SendMessageEvent(roomID, mevt.EventMessage, itemToHTML(feed, item)); err != nil { |
|
|
|
logger.WithError(err).WithField("room_id", roomID).Error("Failed to send to room") |
|
|
|
if httpErr, ok := err.(mautrix.HTTPError); ok && httpErr.IsStatus(429) { |
|
|
|
return err |
|
|
|
} else { |
|
|
|
logger.WithError(err).WithField("room_id", roomID).Error("Failed to send to room") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|