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

allow message sending when DB transaction active

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.8
    • Component/s: Messages
    • Labels:

      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

              • Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14