Automattic / syndication

Syndicate your WordPress content.
https://wordpress.org/plugins/syndication/
102 stars 47 forks source link

Timeout issues when adding/editing a site #86

Open stephenharris opened 9 years ago

stephenharris commented 9 years ago

If there are sufficient number of sites being syndicated (I've seen this with 71 sites) then adding a new site or editing an existing site results in a 500 error (PHP Fatal error: Maximum execution time of 30 seconds exceeded).

The reason is that editing, creating or deleting a site clears the cron jobs and so triggers a content pull. If the content pull takes too long, the user gets a white screen.

The obvious fix is to remove these too lines: https://github.com/Automattic/syndication/blob/master/includes/class-wp-push-syndication-server.php#L50-L51

but I'm not sure if those two lines are strictly necessarily or not. Beyond not having to do a manual pull or wait till the next scheduled pull for changes to be reflected, there doesn't seem to be any advantage.

stephenharris commented 8 years ago

Doh! Obviously, resetting the cron jobs is required, when you're adding a new site. Instead I've set the initial time for the cron job to be time() + 60 rather than time() - 1 since the latter seemed to be triggering the job immediately and as part of the same request.

This 'breaks' the 'pull now' which doesn't quote pull now, but in a minutes time...

emrikol commented 8 years ago

It looks like this may still be an issue for v2.1. When there are a large number of sites, it still iterates through them and creates a cron job.