Don't attribute context cancellation to firehose record content

main
Max Ignatenko 2024-04-06 22:14:58 +01:00
parent ecf2fc57d8
commit 52dd38f11b
1 changed files with 5 additions and 0 deletions

View File

@ -171,6 +171,11 @@ func (c *Consumer) runOnce(ctx context.Context) error {
switch header.Op {
case 1:
if err := c.processMessage(ctx, header.Type, r, first); err != nil {
if ctx.Err() != nil {
// We're shutting down, so the error is most likely due to that.
return err
}
const maxBadRecords = 500
var count int64
if err2 := c.db.Model(&BadRecord{}).Where(&BadRecord{PDS: c.remote.ID}).Count(&count).Error; err2 != nil {