Skip to content

Make localization more defensive #4623

@swirtSJW

Description

@swirtSJW

User Story

On PDC we had an instance where downloadUrl was empty. This proved to be catastrophic not only for that dataset but for many other functions of the site dependent on queues

Detailed Feature Description

See problem VV

Problem and Motivation

This error while trying to localize a file in the localize_import queue

 [error]  Error: Call to a member function setupState() on null in FileFetcher\FileFetcher->runIt() (line 106 of /var/www/html/vendor/getdkan/file-f  
  etcher/src/FileFetcher.php) #0 /var/www/html/vendor/getdkan/procrastinator/src/Job/Job.php(43): FileFetcher\FileFetcher->runIt()                      
  #1 /var/www/html/vendor/getdkan/procrastinator/src/Job/AbstractPersistentJob.php(21): Procrastinator\Job\Job->run()                                   
  #2 /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/Service/ResourceLocalizer.php(104): Procrastinator\Job\AbstractPersistentJob->ru  
  n()                                                                                                                                                   
  #3 /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/Service/ResourceLocalizer.php(143): Drupal\datastore\Service\ResourceLocalizer->  
  localize()                                                                                                                                            
  #4 /var/www/html/docroot/modules/contrib/dkan/modules/datastore/src/Plugin/QueueWorker/LocalizeQueueWorker.php(87): Drupal\datastore\Service\Resourc  
  eLocalizer->localizeTask()                                                                                                                            
  #5 /var/www/html/docroot/core/lib/Drupal/Core/Cron.php(270): Drupal\datastore\Plugin\QueueWorker\LocalizeQueueWorker->processItem()                   
  #6 /var/www/html/docroot/core/lib/Drupal/Core/Cron.php(235): Drupal\Core\Cron->processQueue()  

causes all queue processing to get stuck.

stuck jobs.

Target Audience

  • End Users
  • Developers
  • Administrators
  • Other

Possible Implementation

This could benefit from either a guard clause or a try-catch to keep this from happening.

Acceptance Criteria

this error is handled gracefully

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions