I'm looking for any code to find hooks called for edit activity.

Problem we have occurs whil sending mailing, that tooks 1-2min for one send email, I've made some debug and found that this code slows

/CRM/Mailing/BAO/MailingJob.php::writeToDB, Bulk Email activity

$activity = civicrm_api3('Activity', 'create', $activity);
    [source_contact_id] => 12311
    [activity_type_id] => 19
    [source_record_id] => 2082
    [activity_date_time] => 20231205095113
    [subject] => Zaproszenie
    [status_id] => Completed
    [campaign_id] =>
    [id] => 2660265


I've found that 'civi.api.respond' for this update takes lot of time...

Is there any way to find wich hooks are called while this api3 call ? I've added some debug code in civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php::callListeners

\Civi::log()->notice('callListener: ', $listener);

But it's not helping..

1 Answer 1


Not entirely sure how searching for activity create hook would help in your case ( which sounds like a DB optimization issue ).

However, let's shoot in the dark and see where it leads us: what if you try to disable the "Enable CiviMail to create activities on delivery" option on this page civicrm/admin/setting/preferences/mailing?reset=1 ? Would this make your mailings faster and the database more responsive?

  • Yes, this makes mails sendin blazingly fast :-) But I wan't to make it work as it should, because we have lot of installs and only on this one we have problem... Dec 11, 2023 at 10:25
  • Great to hear a fast band-aid helped. I still think you may want to check things on your database side first, maybe use some well-known DB optimization tools & techniques and point the finger at civi after that. What I'm saying is, I can't remember experiencing issues like yours across any projects under my management, even on shared hostings. Not sure if it helps, however you may want to explore options here: Settings - CiviMail
    – yurg
    Dec 11, 2023 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.