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

change '*' observer priority handling

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.6
    • Events API
    • BACKEND Sprint 3

    Description

      At present we calculate the priority of "" and observers of individual events together, I would like to propose to always first execute all "" ordered by priority and then all other observers sorted separately by priority.

      benefits:
      1/ tiny bit faster when constructing the nested array of observers
      2/ tiny less memory used because the cached list of handlers would be smaller ('*' would not be repeated)
      3/ this would allow us to introduce observing of parent class events without breaking BC (if we ever want that in the future)

      problems:
      1/ specific observers could not be executed first and '*' could not be last

      The priority was introduced in order to allow the logging subsystems to process events as the first observer to eliminate data modifications from previous handlers. So far we did not find any other major use cases for the priority flag in observers - ideas?

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              skodak Petr Skoda
              Sam Hemelryk Sam Hemelryk
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                18/Nov/13