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

change '*' observer priority handling

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Events API
    • Labels:
    • Sprint:
      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

              Assignee:
              skodak Petr Skoda
              Reporter:
              skodak Petr Skoda
              Integrator:
              Sam Hemelryk
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13