Add minimal time difference to consider two articles timely different

This commit is contained in:
Martin Rotter 2024-01-03 12:38:56 +01:00
parent 1eebd5f27e
commit 57cc08762a
2 changed files with 5 additions and 2 deletions

View File

@ -1685,7 +1685,8 @@ UpdatedArticles DatabaseQueries::updateMessages(const QSqlDatabase& db,
//
// 3) FOR ALL SERVICES:
// Message has its date fetched from feed AND its date is different
// from date in DB or content is changed.
// from date in DB or content is changed. Date/time is considered different
// when the difference is larger than MSG_DATETIME_DIFF_THRESSHOLD
//
// 4) FOR ALL SERVICES:
// Message update is forced, we want to overwrite message as some arbitrary atribute was changed,
@ -1702,7 +1703,8 @@ UpdatedArticles DatabaseQueries::updateMessages(const QSqlDatabase& db,
bool cond_2 = !message.m_customId.isEmpty() && !feed->getParentServiceRoot()->isSyncable() &&
(message.m_title != title_existing_message || message.m_author != author_existing_message ||
(!ignore_contents_changes && message.m_contents != contents_existing_message));
bool cond_3 = (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message) ||
bool cond_3 = (message.m_createdFromFeed && std::abs(message.m_created.toMSecsSinceEpoch() -
date_existing_message) > MSG_DATETIME_DIFF_THRESSHOLD) ||
(!ignore_contents_changes && message.m_contents != contents_existing_message);
if (cond_1 || cond_2 || cond_3 || force_update) {

View File

@ -70,6 +70,7 @@
#define RESELECT_MESSAGE_THRESSHOLD 500
#define ICON_SIZE_SETTINGS 16
#define TRAY_ICON_BUBBLE_TIMEOUT 20000
#define MSG_DATETIME_DIFF_THRESSHOLD 1000 * 120 // In seconds.
#define CLOSE_LOCK_TIMEOUT 500
#define DOWNLOAD_TIMEOUT 30000
#define MESSAGES_VIEW_DEFAULT_COL 100