I've got a custom queue worker that used to work fine in Drupal 9, but stopped working after the upgrade to Drupal 10.
I've narrowed it down to the getPluginDefinition method not returning anything. So in the core Cron.php I get a warning on the following line:
$lease_time = $worker->getPluginDefinition()['cron']['time'];
If I comment out this line, and just set the $lease_time to 1 my QueueWorker works fine. Clearly the worker itself is OK, but getting the meta data fails for some reason.
This is what my class definition looks like:
namespace Drupal\module_send_pdf\Plugin\QueueWorker;use Drupal\Core\Mail\MailManagerInterface;use Drupal\Core\Plugin\ContainerFactoryPluginInterface;use Drupal\Core\Queue\QueueWorkerBase;use Symfony\Component\DependencyInjection\ContainerInterface;/** * A Mail Sender that sends e-mails on CRON run. * * @QueueWorker( * id = "module_pdf_mail_sender", * title = @Translation("PDF Mail Sender"), * cron = {"time" = 105} * ) */class MailSender extends QueueWorkerBase implements ContainerFactoryPluginInterface {protected $mailManager; public function __construct(MailManagerInterface $mail_manager) { $this->mailManager = $mail_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $container->get('plugin.manager.mail') ); }
As far as I can tell that markup is OK. So what am I missing?