set_delayed_queue_event

March 26, 2020

Name

set_delayed_queue_event

Synopsis

#include "hooks/core/set_delayed_queue_event.h"

| int **set_delayed_queue_event** ( | closure, |   |
|   | mq, |   |
|   | now); |   |

void * <var class="pdparam">closure</var>;
mail_queue * <var class="pdparam">mq</var>;
struct timeval * <var class="pdparam">now</var>;

| int **has_core_set_delayed_queue_event_hook** ( | ); |   |

| void **register_core_set_delayed_queue_event_hook_first** ( | hook, |   |
|   | closure); |   |

ec_hook_core_set_delayed_queue_event_func_t <var class="pdparam">hook</var>;
void *<var class="pdparam">closure</var>;

| void **register_core_set_delayed_queue_event_hook_last** ( | hook, |   |
|   | closure); |   |

ec_hook_core_set_delayed_queue_event_func_t <var class="pdparam">hook</var>;
void *<var class="pdparam">closure</var>;

| int **call_core_set_delayed_queue_event_hook** ( | mq, |   |
|   | now); |   |

mail_queue * <var class="pdparam">mq</var>;
struct timeval * <var class="pdparam">now</var>;

Description

This hook is called to schedule a mail queue maintainer for a mail queue. The default implementation will cancel the maintainer if the queue is empty, else if there are messages in the active queue it will schedule for now + delayed_queue_scan_interval, else (delayed messages only) it will schedule for the next attempt time of the first delayed message or now + delayed_queue_scan_interval, whichever is sooner. You can override this behavior by registering this hook and returning nonzero when you are done; returning 0 will cause the default implementation to run. To cancel an existing maintainer event, you may call mail_queue_stop_maintainer. When creating a mailtainer, the timed event worker must be mail_queue_maintainer, and the closure must be the domain name, which you allocate as a MEMTYPE_STRING. now may be NULL, in which case you should call get_now to get the time.