Explore injecting the event dispatcher in the database service

Created on 7 December 2024, 15 days ago

Problem/Motivation

Follow up for 📌 Move the on-demand-table creation into the database API Needs work .

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

database system

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • Merge request !10483Draft: Closes #3492391 → (Open) created by mondrake
  • Pipeline finished with Failed
    15 days ago
    Total: 3779s
    #361889
  • Pipeline finished with Failed
    14 days ago
    Total: 3769s
    #361971
  • Pipeline finished with Failed
    14 days ago
    Total: 188s
    #362127
  • Pipeline finished with Running
    14 days ago
    #362133
  • Pipeline finished with Failed
    14 days ago
    Total: 3736s
    #362361
  • Pipeline finished with Failed
    14 days ago
    Total: 130s
    #362414
  • Pipeline finished with Running
    14 days ago
    #362421
  • Merge request !10487Closes #3492391 → (Open) created by mondrake
  • Pipeline finished with Failed
    13 days ago
    Total: 188s
    #362595
  • 🇮🇹Italy mondrake 🇮🇹

    mondrake → changed the visibility of the branch 3492391-explore-injecting-the to hidden.

  • Pipeline finished with Failed
    13 days ago
    Total: 3362s
    #362600
  • Pipeline finished with Failed
    13 days ago
    Total: 832s
    #362658
  • Pipeline finished with Failed
    13 days ago
    Total: 108s
    #362688
  • Pipeline finished with Failed
    13 days ago
    Total: 127s
    #362689
  • Pipeline finished with Failed
    13 days ago
    #362690
  • 🇺🇸United States nicxvan

    Why not module_handler?

    You can make it a hook, they are now event listeners and give a lot of the same benefits of event subscribers, they are now classes and are autowired.

    I also think there's less boilerplate needed among other benefits.

  • 🇺🇸United States nicxvan
  • Pipeline finished with Failed
    13 days ago
    Total: 3738s
    #363050
  • Pipeline finished with Canceled
    13 days ago
    Total: 1908s
    #363163
  • Pipeline finished with Failed
    13 days ago
    Total: 3734s
    #363189
  • Pipeline finished with Failed
    12 days ago
    Total: 3736s
    #363301
  • Pipeline finished with Failed
    12 days ago
    Total: 3834s
    #363371
  • Pipeline finished with Failed
    12 days ago
    Total: 202s
    #364213
  • Pipeline finished with Failed
    12 days ago
    Total: 835s
    #364220
  • Pipeline finished with Failed
    10 days ago
    Total: 162s
    #366122
  • Pipeline finished with Failed
    10 days ago
    Total: 485s
    #366125
  • Pipeline finished with Failed
    9 days ago
    Total: 148s
    #367011
  • Pipeline finished with Failed
    9 days ago
    Total: 162s
    #367021
  • Pipeline finished with Failed
    9 days ago
    Total: 668s
    #367022
  • Pipeline finished with Failed
    9 days ago
    Total: 163s
    #367069
  • Pipeline finished with Failed
    9 days ago
    Total: 1830s
    #367075
  • Pipeline finished with Failed
    9 days ago
    Total: 567s
    #367442
  • Pipeline finished with Failed
    9 days ago
    Total: 158s
    #367460
  • Pipeline finished with Success
    9 days ago
    Total: 1218s
    #367461
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹

    @nicxvan re #5 this is about the event dispatcher itself, not about the subscribers.

  • Pipeline finished with Failed
    9 days ago
    Total: 414s
    #367620
  • Pipeline finished with Failed
    9 days ago
    Total: 149s
    #367625
  • Pipeline finished with Success
    9 days ago
    Total: 795s
    #367657
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇳🇱Netherlands daffie

    I think we should add a CR.

  • 🇮🇹Italy mondrake 🇮🇹

    Added some docs inline.

  • Pipeline finished with Failed
    8 days ago
    Total: 467s
    #367794
  • Pipeline finished with Success
    8 days ago
    Total: 1777s
    #367880
  • 🇮🇹Italy mondrake 🇮🇹

    Let’s see if we can make one more step and make the factory a decorator of the event dispatcher.

  • Pipeline finished with Failed
    8 days ago
    Total: 148s
    #368473
  • Pipeline finished with Failed
    7 days ago
    Total: 551s
    #368476
  • Pipeline finished with Failed
    7 days ago
    Total: 565s
    #368659
  • Pipeline finished with Failed
    7 days ago
    Total: 154s
    #368674
  • Pipeline finished with Failed
    7 days ago
    Total: 687s
    #368675
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    7 days ago
    Total: 2109s
    #368682
  • 🇮🇹Italy mondrake 🇮🇹

    Added 2 CR stubs, one [#3494043] for the generic availability of the event dispatcher before container bootstrap, and one [#3494044] for its usage in Database::Connection. Will complete at later stage, doing at this stage has an high risk of getting stale information in it while reviews and tuning still needs to happen.

  • Pipeline finished with Success
    7 days ago
    Total: 4290s
    #368915
  • 🇮🇹Italy mondrake 🇮🇹

    📌 Allow parsing and writing PHP constants and enums in YAML files Needs work would help, we could pass an enum parameter in the service definition file, which we cannot presently.

  • 🇳🇱Netherlands daffie
  • 🇳🇱Netherlands daffie

    Maybe we should do 📌 Allow parsing and writing PHP constants and enums in YAML files Needs work first?

  • 🇮🇹Italy mondrake 🇮🇹

    Thanks for review @daffie!

    #22 would be nice, but I do not see it as a blocker.

    Addressed the comments.

  • Pipeline finished with Failed
    4 days ago
    Total: 459s
    #371181
  • Pipeline finished with Failed
    4 days ago
    Total: 986s
    #371216
  • 🇳🇱Netherlands daffie

    The CI pipeline is not happy. It fails for Drupal\KernelTests\Core\Database\DatabaseEventTest

  • Pipeline finished with Success
    4 days ago
    Total: 1295s
    #371299
  • 🇮🇹Italy mondrake 🇮🇹

    Restored bot happiness. Back to NR.

  • 🇳🇱Netherlands daffie

    The MR looks good to me.
    The IS and the CRs need to be updated.

  • 🇺🇸United States nicxvan

    If you are trying to make this unified post bootstrap then why not have a utility class which you can call instead of the event dispatcher and does a fixed call before bootstrap and dispatches an event once the container is available?

  • 🇮🇹Italy mondrake 🇮🇹

    @daffie thanks, if you do not mind I'd leave this to NR a bit longer to see if more reviews/input come. I will definitely do the CR and IS updates when we have settled on the final solution.

    @nicxvan I am not sure I understand; feel free to open another issue branch and MR if you want to propose an alternative!

  • 🇺🇸United States nicxvan

    What I mean is you're jumping through all these hoops to get the invent dispatcher in place. But you're only calling a fixed output for that.

    You should just replace this with a utility class that before bootstrap calls the static helper you're creating preBootstrapSubscribers to handle.
    So the helper would call the static preBootstrapSubscribers if you are prebootstrap and then call the event dispatcher as it does now after.

    You get the benefits you're looking for with way less code.

  • Merge request !10598Early event dispatcher → (Open) created by nicxvan
  • 🇺🇸United States nicxvan

    Please take a look at MR 10598

  • Pipeline finished with Failed
    4 days ago
    Total: 251s
    #371908
  • Pipeline finished with Failed
    4 days ago
    Total: 3764s
    #371915
  • 🇺🇸United States nicxvan

    nicxvan → changed the visibility of the branch 3492391-early-fixed-event-dispatcher to hidden.

  • Merge request !10607Early event dispatcher → (Open) created by nicxvan
  • Pipeline finished with Success
    3 days ago
    Total: 795s
    #372528
  • 🇮🇹Italy mondrake 🇮🇹

    @nicxvan thanks, I like where MR 10607 is heading, especially in the part where the early subscribers to be registered with the early dispatcher are moved to the database API.

    However, this is creating an (early) event dispatcher that is attached to the Connection class instead of being unique across the request. Not a big deal for now, right, but what if in the future more code would need to dispatch events early? Cache for instance may want to dispatch an event to be responded by a database listener (again, not the case know, but to prepare for possible future). I'd rather keep a singleton somewhere outside of the Connection class, so that we do not end up with vertical dispatchers not talking to each other. That's an architecture topic, tagging so we can have a review and guidance.

    Then, I think we should use a closure also to register the early subscribers in place of the const array - so to allow passing instantiated objects that may require parameters (atm in both MRs the assumption is that the subscribers have no parameters in the construction).

Production build 0.71.5 2024