Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-45941

allow message sending when DB transaction active

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.7
    • 2.8
    • Messages

    Description

      The problem here is that we do not want to send messages to external systems while transaction is in progress because the actual message might get rolled back later. At the moment Moodle just stops in message_send() with $DB->transactions_forbidden().

      Solution is to add buffer in between $DB->insert_record('message', $savemessage) and $processors[$procname]>object>send_message($eventdata). This would allow us to return messageid from the message_send() for full backwards compatibility.

      The implementation would use the same trick as \core\event\manager::database_transaction_rolledback() and \core\event\manager::database_transaction_commited() in the moodle_database class.

      Later we can abstract the transaction notification callbacks to be configurable.

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              skodak Petr Skoda
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Marina Glancy Marina Glancy
              Andrew Lyons Andrew Lyons
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Nov/14