Tag queue API queries to enable query alteration (and backport it)

Created on 4 August 2015, almost 10 years ago
Updated 26 May 2025, 8 days ago

For several reasons, I would like to hook_query_alter Queue API claimItem queries:

  • Dequeue items only after some configurable time has elapsed since enqueueing (DelayedQueue use case)
  • Do not return queue items if certain callback prevents it (HookableQueue use case)
  • Other cases I can't remember now...

A possible solution could be to write several Queue Backends that override Drupal's default implementation. But, AFAIK those backends would not be 'stackable'. I mean, be able to pick which features you would like a specific queue to configure via some kind of flexible queue backend. So, I thought that hook_query_alter'ing those could do the trick. I would prefer to write a single module in which I could configure the above settings independently.

Also, this could be an improvement on DX if someone wants ever to do other crazy things with queues (think on sending queue queries to a different, dedicated MySQL instance) that comes at no cost, AFAICT.

So, tagging the DatabaseQueue queries could be an easy and simpe enough way to achieve it. Since tagging will not incur in any performance penalty and would not have any compatibility problems my prpoosal would be:

  • Discuss which tags to add to which queries
  • Add those tags once defined
  • Backport them to Drupal 7, where I need them the most

Note that backporting this change to D7 looks like a backwards compatible change and it's an added value to attract more contributors to work in (myself included).
Edit: As a (working) proof of concept I've created Tagged SystemQueue β†’ and implemented DelayedQueue use case successfully. It would be nice to have this in core for convenience.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡ͺπŸ‡ΈSpain amontero Barcelona

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024