Project

General

Profile

Bug #10290

newsletters-lite IP address lookup is very bad

Added by Boone Gorges 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority name:
Normal
Assignee:
-
Category name:
-
Target version:
Start date:
2018-09-05
Due date:
% Done:

0%

Estimated time:

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

History

#2 Updated by Boone Gorges 6 months ago

  • Status changed from New to Resolved

Also available in: Atom PDF