Newsletter AJAX call hits size limit
-
Yesterday I ran into an issue where multiple factors combined to produce a bug on the Newsletter listings page. The issue manifests as an empty list of Newsletters, despite having many of them. No data is actually lost as far as I can tell.
For those looking for a quick fix, this problem may be mitigated by changing the items per page under Screen Options.
Details:
The call to the MailPoet JSON API (endpoint: newsletters, method: listing) produces in no output when the body size is over 512435 characters. This seems curiously close to a 512K limit though I haven’t traced what enforces it. I *have* confirmed that the issue is in the output itself – execution continues up until the finalecho wp_json_encode(...)
in the Response->send().The main issue that I hope to address is the fact that the payload is 512K for a result set of 20 newsletters. This is horribly inefficient.
A significant contributing factor is that the rendered HTML and text bodies of all currently sending and previously sent newsletters are included in the payload.
Thankfully, we are provided a filter that allows a temporary solution. Ideally, code could be optimized so as to not query those fields from the database in the first place. There are also numerous opportunities for caching, especially for a queue which has been sent and completed.
@wysija, let me know if I can provide further detail about my situation and environment.
- The topic ‘Newsletter AJAX call hits size limit’ is closed to new replies.