Support » Plugin: BuddyPress Group Email Subscription » large number of notifications holding up AJAX response

  • We have a member site where, if a member posts an activity update to a group, and the group has a large number of members who are subscribed to notifications, the email sending takes a while and holds up the delivery of the AJAX response to add the update to the page.

    Firstly, we forked this plugin at 3.7.2 – but reading the changelog, I’m not sure if we’ve missed any changes which might help with this.

    I’ve been considering a couple of different approaches:

    1. Hook into something before group subscription emails are sent, set ignore_user_abort( true ), and send the activity update back to the browser early. I’m not sure what would happen when the core BP response to the browser eventually happens. Plus, I would probably have to duplicate some core BP response code in my hook, which of course risks missing BP updates.
    2. Change the way the group subscription emails are sent to bundle them up into one batch to send to our email service (Mandrill). I assume this might speed up email sending, though I’m not sure by how much. Plus, while the fact that we’ve forked the group subscription plugin means we’re free to do this, it would mean further deviation from the plugin, making synching recent plugin changes harder (and this is something we’re hoping to do sometime).

    Neither options seems ideal. Before experimenting, I wanted to ask, have you encountered this issue, and do you know of optimal ways of addressing it? It all seems to hinge on the plugin, the fact that it does the email sending before the response is sent to the browser.

    The only other approach I can think of is somehow hooking after bp_nouveau_ajax_post_update() is called to send subscription emails, but that probably involves further complications (e.g. sending emails when an activity update is posted without AJAX, plus similar forking / synching code issues as above).

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Boone Gorges


    Hi @gyrus

    It’s likely that updating to the latest BPGES would help with your issues. A new system was introduced in version 3.9.0 that overhauls the way that subscription info is stored. Part of this change involves the asynchronous sending of emails, so that they’re handled in a background process that doesn’t hold up the page load. This was, in fact, the main impetus for the major rewrite in 3.9.0.

    Can you say more about your fork? If we could make changes to BPGES that would make it possible for you to get back to the mainline plugin – either by fixing bugs or by introducing hooks that allow you to customize the behavior – we’d be happy to consider them.

    Thread Starter Steve Taylor


    Thanks for the quick response.

    We initially forked to manage some complex debugging – I think we needed to log certain things where there weren’t hooks available, and the code needed to sit there and run for a while to catch an unusual problem we were having.

    But since then there’s been some tweaks, nothing major I think.

    One was rejigging of the markup in ass_default_subscription_settings_form() – basically our styling couldn’t work with labels outside radio inputs, they needed to be wrapped around the inputs. It actually looks like you’ve changed in this direction since we forked. Same situation with ass_group_subscribe_settings() as well I think.

    The main other change was more fine-grained control of $link in ass_group_notification_activity(). It looks like this code has changed significantly in the meantime, enough so that I can’t see what change I would suggest to the current plugin. Looking at 3.7.2, I replaced lines 145-152 with this:

    The function ass_generate_notification() which $link is passed to doesn’t seem to be used anymore? bpges_generate_notification() instead? I assume $link could be easily filtered here?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘large number of notifications holding up AJAX response’ is closed to new replies.