oliverdavies.uk/content/node.622d54e2-44a7-4e74-b87f-47df892c2169.json
2025-05-11 20:02:12 +01:00

100 lines
No EOL
4.5 KiB
JSON

{
"uuid": [
{
"value": "622d54e2-44a7-4e74-b87f-47df892c2169"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-04-16T14:12:58+00:00"
}
],
"revision_uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"revision_log": [],
"status": [
{
"value": true
}
],
"uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"title": [
{
"value": "Queuing long-running tasks"
}
],
"created": [
{
"value": "2024-07-17T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-04-16T14:12:58+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2024\/07\/17\/queuing-long-running-tasks",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>Do you have long-running or performance-heavy tasks in your application?<\/p>\n\n<p>What about performing complex actions when a user completes a task, such as submitting a form?<\/p>\n\n<p>What if the action took several seconds or minutes to complete?<\/p>\n\n<p>The user would assume their submission failed and may either leave or submit the form again and cause duplicate submissions.<\/p>\n\n<p>Instead, maybe use a queue.<\/p>\n\n<p>When the user submits the form, all you need to do is create a queue item for that submission and let the form submit as normal.<\/p>\n\n<p>In the background, the queue items will be processed when they can take more time or memory to perform the tasks and without blocking the user - giving them a better experience.<\/p>\n\n<p>Drupal supports queues by default, storing queue items in its database.<\/p>\n\n<p>For an example, see the <a href=\"https:\/\/www.drupal.org\/project\/private_message_queue\">Private Message Queue module<\/a> on Drupal.org.<\/p>\n\n<p>I wrote it for a client project to use queues when sending private messages to event attendees, which could be hundreds per event.<\/p>\n\n<p>Without a queue, the request would have taken a long time to complete, or likely timed out.<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>Do you have long-running or performance-heavy tasks in your application?<\/p>\n\n<p>What about performing complex actions when a user completes a task, such as submitting a form?<\/p>\n\n<p>What if the action took several seconds or minutes to complete?<\/p>\n\n<p>The user would assume their submission failed and may either leave or submit the form again and cause duplicate submissions.<\/p>\n\n<p>Instead, maybe use a queue.<\/p>\n\n<p>When the user submits the form, all you need to do is create a queue item for that submission and let the form submit as normal.<\/p>\n\n<p>In the background, the queue items will be processed when they can take more time or memory to perform the tasks and without blocking the user - giving them a better experience.<\/p>\n\n<p>Drupal supports queues by default, storing queue items in its database.<\/p>\n\n<p>For an example, see the <a href=\"https:\/\/www.drupal.org\/project\/private_message_queue\">Private Message Queue module<\/a> on Drupal.org.<\/p>\n\n<p>I wrote it for a client project to use queues when sending private messages to event attendees, which could be hundreds per event.<\/p>\n\n<p>Without a queue, the request would have taken a long time to complete, or likely timed out.<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-04-16T14:12:58+00:00",
"guid": null,
"hash": "e3d2f5da90f0708c2f7168e8c649f8c9",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}