dnnsoftware / Dnn.Platform

DNN (formerly DotNetNuke) is the leading open source web content management platform (CMS) in the Microsoft ecosystem.
https://dnncommunity.org/
MIT License
1.03k stars 751 forks source link

[Enhancement]: PurgeScheduleHistory - simple improvement #6172

Open trouble2 opened 1 month ago

trouble2 commented 1 month ago

Is there an existing issue for this?

Description of problem

I saw in some DNN instances, my schedulehistory table was rather large. Even if I run the cleanup task (in the scheduler)

So I noticed it only deletes the history items of active tasks. So for a given task in the schedule let's say there are 1000 history items in the table, and I set it to only keep the last 25 items. However the task is not enabled, it will keep the 1000 history items in the schedulehistory table.

Description of solution

There is a SP called PurgeScheduleHistory and somewhere it says:

INNER JOIN dbo.[ScheduleHistory] sh ON s.ScheduleID = sh.ScheduleID WHERE s.Enabled = 1 AND s.RetainHistoryNum <> -1

So if you would remove the s.Enabled =1 part, it will actually clean what is has to clean :-) Even though the task is disabled, I still think when the setting is keep the last XX records, it should still only keep the last XX records... This keeps the table nice and clean.

Description of alternatives considered

None

Anything else?

No

Do you be plan to contribute code for this enhancement?

Would you be interested in sponsoring this enhancement?

Code of Conduct