I tried to send an email with Messenger to a large part of our users, and it seems the process times out.
How is the email being sent out? Has there been any thought about branching it off to a background process to avoid PHP timeout errors? I am not up to date in how you would do that, by assume there must be some way
Good question! You’re right, a background process could certainly help in this instance. It’s been very briefly discussed but not on the roadmap yet, so I’ve added it to the v15 board to look into: https://trello.com/b/aO7W3YsF/gibbon-v15
Any idea of approximate number of emails it timed out on?
In the meantime, you can help prevent the timeout by increasing the max_execution_time for PHP (in .htaccess it looks like
php_value max_execution_time 300
for a 5 minute timeout, or <code class="CodeInline">max_execution_time = 300 under Resource Limits in phpini). The caveat for this is that increasing the timeout has the potential to increase the strain on your server, as any process that would normally timeout will continue taking resources for longer chunks of time, so its best as a temporary measure until something can be coded to help with bulk sending.
Hope this helps!
@ross, thanks for this input. I wonder, if you gave @UrkoM a couple of tips on the best modern PHP approach to this, if he might be able to put together a solution. I reckon he has the skills ; )
I want to get into development, yes. Do you have any recommendations for setting up a development environment? What do you guys use for:
- Debugging PHP code
- Running a development server
Mmm… Some of the answers to this question seem simple enough to implement, though they are specific to Linux:
Awesome I use MAMP for a dev environment, Sublime Text editor (I believe Ross uses Atom), and for debugging I mostly rely on linter/code intel tools on the back-end and firefox developer tools on the front-end.
I’ve used the exec() method so-far and it’s worked pretty well for background processing PDFs and long-running scripts (on max & linux). Looks like there’s ways to modify it for windows too. Some of the other methods for background processing seem to involve cron jobs, installing extensions, or using task-runners, which would all add extra steps for setting up Gibbon that may be overly complicated to require for a core module like Messenger
Attached is an example of a class that can start/stop processes, and uses a small text file to track a pID in process. This one enforces a single instance of a background process (which I use to display a ‘Please wait’ message and cancel button), so it’s not an exact solution for the Messenger case but it may be a helpful starting point.
Ok, please don’t hold your breath on this. I am brushing up these days on Git, GitHub, using PRs, and getting a good PHP IDE going (Atom+Nuclide seems good on Ubuntu, what I use).
I’ll get a Gibbon dev server on my machine, and see where we go from there.
Not holding breath…but excited to hear about your progress : ))
Feel free to give a shout with any dev questions (sent a Slack invite)
Ever deeper into the rabbit hole goes Urko…
Weighing in on the IDE, I’m using exclusively vin through a Linux terminal for what I’m doing. SQL through HeidiSQL because it’s excellent.
Re the main issue though, exec probably is best for simple to use background processes. If the mail was in the DB, I know some queuing apps can actually feed back SMTP status as well. Could be handy for those people who don’t update their email addresses or simply to diagnose sending errors.
Sendmail on Linux offers a queuing feature, I’m sure. On Windows? You got me. If it’s an SMTP server the underlying connection should technically be the same. Maybe WordPress would have some relevant source code?