Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Why does the interface for maintenanceworker include specific tasks like CleanupAnonymousUsers() and PurgeAccountData()??
It's an interface. It should only be implementing the members required to be a maintenance worker routine.
If I want to create my own maintenance routines and register it as an IOC container ([RegisterFor(typeof(IMaintenanceWorker))] now I have to also implement those unwanted members in my custom class.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
Your post inspired me to look at the Maintenance code since it may be something we need to hook into at some point. It looks like the IMaintenance interface inherits from IJob which only has Work() and Stop(). The Scheduler implementation creates a maintenance job, and passes it the IMaintenance implementation, but that job actually takes an IJob parameter in it's constructor.
Take a look in the /CommerceBuilder/Services/Scheduler directory to see how they piece it all together. IReviewReminderService inherits from IJob. ReviewReminderService implements IReviewReminderService. Scheduler has a method ScheduleReviewRemindersService which shows how they resolve the service and set up a job on an interval. The MaintenanceWorker actually looks like it is just another IJob implementation fired off by the same Scheduler.
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Thanks. Their scheduler service design hasn't changed much in 15 years. I don't bother with all that complexity.
My original question wasn't how does it work. It was why there are specific behaviors coded into an interface. IOC container interfaces should be abstract and limited to only the minimum necessary to implement it. I think the answer to my question is there are two maintenance routines that have to be exposed because they can be fired from the admin Maintenance settings page. That's probably why, although it still feels sloppy to me.
You want to do server-side automation easily? Install the nuget package HangFire. Been using it for years. Rock solid reliability, stupid simple to implement. Includes it's own job queue management dashboard tool.
I run 14 different scheduled automation jobs every day. I monitor the progress of UPS return labels, post ship dates and tracking numbers from UPS QuantumView, process UPS billing data into order profit/loss calculations, update expected ship dates from vendors, generate cloud search provider feed files....everything. No global.asax file changes. No cryptic System.Threading.Timer() crap. It's just server-side automation the way it should be.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
I looked closer specifically at IMaintenanceWorker and MaintenanceWorker and now see your point.
CleanupAnonymousUsers and PurgeAccountData appear to be public interface members because AC specifically uses those from the Store Admin to clean up anonymous users and purge credit card data, whereas the rest are all nested and only used within the RunMaintenance routine.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close