Problem/Motivation
When deleting a job in drupal, the page gives the following errors in the log:
Smartling failed to delete a file in Dashboard: JobID11550_en_fr-BE.xml. Error: Guzzle:RequestException: Client error: `POST https://api.smartling.com/files-api/v2/projects/60ab0f659/file/delete` resulted in a `400 Bad Request` response: {"response":{"code":"VALIDATION_ERROR","errors":[{"key":"file.not.found","message":"The file \"JobID11550_en_fr-BE.xml\" (truncated...)
Guzzle:RequestException: Client error: `POST https://api.smartling.com/files-api/v2/projects/60ab0f659/file/delete` resulted in a `400 Bad Request` response: {"response":{"code":"VALIDATION_ERROR","errors":[{"key":"file.not.found","message":"The file \"JobID11550_en_fr-BE.xml\" (truncated...)
Can this be handled more gracefully to the user?
Issue fork tmgmt_smartling-3575718
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
loparev commentedHi @j_bekaert,
When user deletes TMGMT Job the connector tries to delete corresponding file in Smartling and if there is no such file it just prints this `Smartling failed to delete a file in Dashboard` message to the logs. Could you please describe what exactly graceful handling do you expect?
Comment #5
nickolajPatch handles the `file.not.found` error gracefully during job deletion by logging it as a warning instead of an error, since the desired state (file removed) is already achieved. Other API errors are still logged as errors.
Comment #6
j_bekaert commentedHi @loparev, thanks for this improvement.
I'd like to raise a related but separate concern: the job deletion flow has a performance problem that can cause 504 timeouts on jobs with multiple files/attachments, the larger the job, the more change we get the timeout. In tmgmt_smartling_tmgmt_job_predelete(), all Smartling API calls (audit log + file delete) run synchronously and sequentially within the web request. For each file, that's 2 HTTP POST calls to the Smartling API.
Is it an idea to either queue these so it can be processed in the background or use Drupal batches?
Happy to help work on either approach if there's interest.
Comment #8
loparev commentedthanks @j_bekaert and @nickolaj, this change is included to 8.x-9.23.
@j_bekaert please open separate ticket since it's another issue. I will take a look.
Comment #9
loparev commented