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:
parent
077addadde
commit
bdeb5bbc32
1 changed files with 1 additions and 0 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue