Unexpected change in callback behaviour

Created on 17 February 2025, 8 days ago

Problem/Motivation

Translation jobs are no longer immediately downloaded to the CMS once complete after updating to 9.13 or later.

<!--break-->

This is due to https://git.drupalcode.org/project/tmgmt_smartling/-/merge_requests/31 which includes the change:

Callback controllers (download file and download attachment controllers) schedule for download into the download queue instead of downloading right away.

The client site where I spotted this is currently configured with an hourly cron as it's a headless CMS and historically hasn't needed to be more frequent. This change has degraded the experience for content editors who now have an extra step to manually request translations to be downloaded, or wait a long time to see updates.

Steps to reproduce

Update the module to 8.x-9.13 or later and translations are no longer downloaded straight away by the callback system.

Proposed resolution

Possible solutions may include adding the ability to configure if callbacks download immediately or add to queue, patching, or just changing cron settings.

I was wondering if someone could share context around why this change was made?
It would be nice to understand more about it before considering our options for the site in question.
This new behaviour feels less intuitive to me as a site now relies on cron runs to download translations despite the callback informing the site that translations are ready to download. At that point why not check for updates just using cron?

One other note, I feel it would have been great to communicate this change in the 9.13 release notes. I appreciate this is a bit of an edge case, but it would have been nice for it to be included just in case.

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

9.13

Component

Code

Created by

🇬🇧United Kingdom ben-ryder

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

Comments & Activities

  • Issue created by @ben-ryder
  • Hi @ben-ryder,

    This change was made because it's possible that downloading + applying the translated file will take more time than Webhook's response timeout. It's recommended to respond as quickly as possible otherwise webhook will retry (causing unexpected results) and eventually give up. We had such cases before, so we decided to implement this change again because we can't guarantee the download/apply time.

    At that point why not check for updates just using cron?

    Drupal cron does two things: runs cron hooks and then processes defined queues. TMGMT Smartling puts TMGMT Jobs into the download queue from two places: pushback controller (webhook) and cron hook (asking Smartling API for a list of translated files directly). So, if queues are processed independently (of Drupal cron) and frequently (by drush or Drupal console tools being triggered from external cron from the site hosting side) then there will be no delay in delivering translations by webhooks. I know people do this on Acquia and Pantheon hostings.

    It would be nice to understand more about it before considering our options for the site in question.

    I think, one of the possible options is not to rely on queue processing by Drupal cron and to run queue processing independently and more frequently.

    Possible solutions may include adding the ability to configure if callbacks download immediately or add to queue

    We will consider this option.

    One other note, I feel it would have been great to communicate this change in the 9.13 release notes. I appreciate this is a bit of an edge case, but it would have been nice for it to be included just in case.

    You're right. I've updated the release notes for 8.x-9.13 to avoid such a case in the future, thanks for pointing this out.

  • 🇬🇧United Kingdom ben-ryder

    Hi @loparev, thank you so much for your thorough reply. It is really helpful and has cleared up the confusion I had.

    Your explanation around why the change was made makes perfect sense, and your suggestion to consider processing the queues independently of cron is a really good one I'd not thought of.
    My issue here was basically just that I was missing the context to understand the change and what the best options would be as a result, after reading your reply I'll likely look at queue processing over something like trying to get the old behaviour back.

    Thanks again for you time and reply, much appreciated.

Production build 0.71.5 2024