Delete Inactive Subscribers Cron

Scott

Member
My lists are getting bigger and I'm getting gateway timeouts when trying to clean up inactive subscribers.

Will the "Delete Inactive Subscribers" cron job run more efficiently than manually searching and deleting on the "All Subscribers" page?
 

twisted1919

Administrator
Staff member
My lists are getting bigger and I'm getting gateway timeouts when trying to clean up inactive subscribers.
Why not try to increase the timeout values a bit, if that's acceptable.

Will the "Delete Inactive Subscribers" cron job run more efficiently than manually searching and deleting on the "All Subscribers" page?
It will since it's done in command line where is no timeout. I advise run it on a test result set first to make sure it does what you're after.
 

Scott

Member
@twisted1919 I thought the command was supposed to delete all subscribers with no opens/clicks within the specified time period. Before and after look at subscribers in the application appears to be exactly the same. No subscribers deleted via the command

/opt/cpanel/ea-php73/root/usr/bin/php -q /home/homit/public_html/domain.com/apps/console/console.php delete-inactive-subscribers --list_uid="######" --time="-1 months" --limit=1000 --verbose=1

"Done processing 2712 subscribers out of which 0 were inactive from which 0 were deleted successfully and 0 had errors!"

Screen Shot 2021-01-05 at 13.20.49.png
 

Scott

Member
I'm not sure exactly what's happening but it's definitely not working as it should as no subscribers get deleted or unsubscribed. But when I use the same search parameters in the UI of the application I get results.
 

laurentiu

Active Member
Staff member Support Staff
I'm not sure exactly what's happening but it's definitely not working as it should as no subscribers get deleted or unsubscribed. But when I use the same search parameters in the UI of the application I get results.
This is happened because filter from web interface will grab all subscribers which Did not open one campaign in time interval selected, like in your picture you will get all subscribers which "Did not open" one campaign in the last 1 month.
The Delete Inactive Subscribers command works a little differently, because the --time parameter is used to compare the subscriber's date when it is added to a list. For example your command will delete all subscribers which were added to the list more than a month ago and not open or click one campaign.
 

Scott

Member
This is happened because filter from web interface will grab all subscribers which Did not open one campaign in time interval selected, like in your picture you will get all subscribers which "Did not open" one campaign in the last 1 month.
The Delete Inactive Subscribers command works a little differently, because the --time parameter is used to compare the subscriber's date when it is added to a list. For example your command will delete all subscribers which were added to the list more than a month ago and not open or click one campaign.

Ahh ok thank you for that explanation. So this command isn't what I'm looking for.

Is there a way to run a command of what I'm looking for? Similar to the search via the interface.

I was thinking about learning a bit of sql to manage the database since I assume query directly in sql run much faster and therefore I can delete inactive subscribers easier and quicker instead of waiting so long for the interface since it can take 2-3 minutes at times. Or would these queries still take 2-3 minutes even running it through something like phpMyAdmin?
 

ghimes

Member
Staff member Support Staff
Hello,
Learning a new thing is always good and useful, so yes you can go ahead and learn SQL, but doing custom queries directly into the db can break things.
The results that you are getting are different because the concept of 'inactive subscribers' is not the same as the ones that did not open in a time period. If the filter is pretty straightforward, selecting the ones that did not open, for the command things are different in the way that are considered inactive the ones that matching the following conditions at once for the requested time period:
1. Did not received any campaign
2. Did not open
3. Did not click .

You can check in the code apps/common/models/ListSubscriber::getIsInactiveInTimePeriod() method if you are interested.


As for the speed, you will not get a higher speed than the command, especially using phpmyadmin.

Cosmin
 
Top