logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne2  
#1 Posted : Tuesday, May 24, 2022 8:27:00 AM(UTC)
Joe Payne2

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.

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

sweeperqb  
#2 Posted : Tuesday, May 24, 2022 10:55:30 PM(UTC)
sweeperqb

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.
Joe Payne2  
#3 Posted : Wednesday, May 25, 2022 6:00:15 AM(UTC)
Joe Payne2

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.
sweeperqb  
#4 Posted : Wednesday, May 25, 2022 8:42:07 AM(UTC)
sweeperqb

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.

Users browsing this topic
Guest
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.