Bug #10290
closednewsletters-lite IP address lookup is very bad
0%
Description
The newsletters-lite plugin runs an hourly cron job that does the following:
- fetches all subscribers that don't have a recorded country https://github.com/cuny-academic-commons/cac/blob/0899f5900b4470f282a7fa4c4a2ccc94b648bd19/wp-content/plugins/newsletters-lite/wp-mailinglist.php#L470
- for each of them, uses the IP address to contact a third-party tool to get a country lookup https://github.com/cuny-academic-commons/cac/blob/0899f5900b4470f282a7fa4c4a2ccc94b648bd19/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L246
- records that info
The problem in our case is that some sites (studyofreligion.commons.gc.cuny.edu) have some subscribers with IP address 127.0.0.1, and the external services return a null country code for this IP. So they never get their country code set, and the next hour, they get pinged again. Aside from being wasteful, it means that the requests pile up, and it can take upward of 30 minutes for the cron job to run.
It looks like there's a filter I can use to force a country (like US) for this specific IP address https://github.com/cuny-academic-commons/cac/blob/0899f5900b4470f282a7fa4c4a2ccc94b648bd19/wp-content/plugins/newsletters-lite/wp-mailinglist-plugin.php#L287
Updated by Boone Gorges about 6 years ago
- Status changed from New to Resolved
I've added a fix in https://github.com/cuny-academic-commons/cac/commit/f1ce72063ab508873684d1569572f735862d8e93 that should resolve this issue.