Fix Telegram notification spam by marking JSON field as changed (#969)

Fixes issue where Sequelize wasn't detecting changes to the
channel_sent_at JSON field, causing markChannelAsSent() to not
persist updates to the database.

This caused the same notification to be sent via Telegram every
15 minutes (on each scheduler run) because the rate limiting
timestamp was never saved.

The fix adds this.changed('channel_sent_at', true) before save()
to explicitly mark the field as modified, which is required for
Sequelize to detect changes to JSON fields.

Impact: Reduces duplicate Telegram notifications from every 15min
to at most once per 24 hours per task.
This commit is contained in:
Chris 2026-03-24 14:30:31 +02:00 committed by GitHub
parent 077addadde
commit bdeb5bbc32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -309,6 +309,7 @@ module.exports = (sequelize) => {
const sentTimes = this.channel_sent_at || {};
sentTimes[channel] = new Date().toISOString();
this.channel_sent_at = sentTimes;
this.changed('channel_sent_at', true);
await this.save();
return this;
};