Module Description
This module allows specific (code) events to be delayed until the end of page execution, or even until a scheduled time in the future.

This module has nothing to do with calendar or real-world events. It's a code thing only.

THIS CODE DOES NOTHING ON ITS OWN. IT SHOULD NOT BE ADDED UNLESS ANOTHER MODULE NEEDS IT.

The Problem with Events System events are executed at the time they are issued. This means that non-critical actions might be executed during the page build and therefore delay it.

For example, (using exaggerated times just for illustration), the action of a form might be to save an entity but also send ten emails to interested users.

Let's say it takes 0.05 seconds to save the entity, and it takes 0.10 seconds to send a single email. The site should be building the next page after 0.05 seconds, but it has to send 10 emails, so it adds a whole second to the time.

But the event is working exactly the same as an old Drupal hook, it has to be acted on right at that moment.

Delayed events How about if you could delay all that non-critical processing until after the main page processing is complete?

You can.

All you have to do is queue non-critical events until the Symfony Kernel sends its Terminate event (meaning the page has been sent), then execute all those non-critical queued events.

In this example it means the page is delivered after 0.05 seconds, while the time-consuming emails are sent afterwards.

This module provides that choice when dispatching events, and another (even better) one:


* Delayed events: Execute after the page has been sent to the user, which means it will not add time to the user experience of the page.
* Scheduled events: Allow an event to be held until some time in the future then it is launched and can be executed.

How it works If you want an event to be delayed or scheduled you add either one of two interfaces to the custom event class, and then you use a custom event dispatcher. The custom dispatcher treats ordinary events just the way the usual dispatcher does, it adds delayed events to a queue which it executes after the rest of the page, and sends scheduled events to the database where they wait until it's time for them to be launched.

A full explanation is given in the module's README.md file.

Additional modules
* Event Scheduler Publish which provides automatic entity publish and unpublish actions and associated events.

Project Usage
61
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Release Candidate
Module Summary
This module aims to solve the problem of delaying specific code events until the end of page execution or a scheduled time in the future, preventing non-critical actions from delaying the page build process.
Data Name
event_scheduler

OPENAI CHATBOT

OPENAI CHATBOT

12:20:08
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.