{"action":"created","issue":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/11725","repository_url":"https://api.github.com/repos/RocketChat/Rocket.Chat","labels_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/11725/labels{/name}","comments_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/11725/comments","events_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/11725/events","html_url":"https://github.com/RocketChat/Rocket.Chat/pull/11725","id":349129232,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MzE3NTky","number":11725,"title":"[FIX] Corrected timefield comparison for message retention policy cron","user":{"login":"TheReal1604","id":5877910,"node_id":"MDQ6VXNlcjU4Nzc5MTA=","avatar_url":"https://avatars3.githubusercontent.com/u/5877910?v=4","gravatar_id":"","url":"https://api.github.com/users/TheReal1604","html_url":"https://github.com/TheReal1604","followers_url":"https://api.github.com/users/TheReal1604/followers","following_url":"https://api.github.com/users/TheReal1604/following{/other_user}","gists_url":"https://api.github.com/users/TheReal1604/gists{/gist_id}","starred_url":"https://api.github.com/users/TheReal1604/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheReal1604/subscriptions","organizations_url":"https://api.github.com/users/TheReal1604/orgs","repos_url":"https://api.github.com/users/TheReal1604/repos","events_url":"https://api.github.com/users/TheReal1604/events{/privacy}","received_events_url":"https://api.github.com/users/TheReal1604/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-09T13:32:14Z","updated_at":"2018-08-13T01:40:36Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/11725","html_url":"https://github.com/RocketChat/Rocket.Chat/pull/11725","diff_url":"https://github.com/RocketChat/Rocket.Chat/pull/11725.diff","patch_url":"https://github.com/RocketChat/Rocket.Chat/pull/11725.patch"},"body":"@vynmera I think it would be better to compare the room \"ts\" timefield not the _updatedAt field for various reasons:\r\n\r\nIf a users change the name or description of the channel the _updatedAt field is touched and the messages in this channel gets not cleared\r\n\r\nI found this issue after enabling the retention policy for our system with 365 days retention time - but it doesnt clean any messages. If I take the manual wizard it is cleaning messages.\r\n\r\nThe ground zero for this is, we migrated our instance to LDAP and renamed ALL user accounts - this results in that the _updatedAt field of all channels got updated - unfortunately this timefield is now not older than the 365 days, but messages in it are older than that."},"comment":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/comments/412388259","html_url":"https://github.com/RocketChat/Rocket.Chat/pull/11725#issuecomment-412388259","issue_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/11725","id":412388259,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjM4ODI1OQ==","user":{"login":"vynmera","id":39674991,"node_id":"MDQ6VXNlcjM5Njc0OTkx","avatar_url":"https://avatars2.githubusercontent.com/u/39674991?v=4","gravatar_id":"","url":"https://api.github.com/users/vynmera","html_url":"https://github.com/vynmera","followers_url":"https://api.github.com/users/vynmera/followers","following_url":"https://api.github.com/users/vynmera/following{/other_user}","gists_url":"https://api.github.com/users/vynmera/gists{/gist_id}","starred_url":"https://api.github.com/users/vynmera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vynmera/subscriptions","organizations_url":"https://api.github.com/users/vynmera/orgs","repos_url":"https://api.github.com/users/vynmera/repos","events_url":"https://api.github.com/users/vynmera/events{/privacy}","received_events_url":"https://api.github.com/users/vynmera/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T01:40:36Z","updated_at":"2018-08-13T01:40:36Z","author_association":"CONTRIBUTOR","body":"Rereading everything, I understand your misconception more.\n\nYou are operating on the grounds that the algorithm skips channels which are younger than the prune timer. Which is logical, in fact - we could totally have added that by filtering to channels where `ts` is less than, or equal to `newest`. Had the error been made to change this to _lastUpdate, that would have been erroneous.\n\nHowever, this algorithm instead compares a timestamp of the last prune (`lastPrune`) with the last time the channel was touched. If the channel is active, this is no issue. But if the channel hasn't been touched for 30 days, this will cause messages in the channel to possibly be 30 days too old. Once a new message is posted, the room is edited or the server is restarted, those over-date messages will be pruned as normal. This is undocumented behaviour that some people won't want, while others, who are merely using this feature to save disk space, will be OK with it.\n\nI feel the best option here is a cleanly documented `Higher Precision` switch in Admin settings, to disable this check altogether and as such prune more precisely, costing a bit more processing power in return. I will be moving forward to create a PR to address this in the coming week."}}
{"actor":{"display_login":"vynmera"}}