Problem/Motivation

Synchronizing Brightcove entities into Drupal can potentially cause Drupal cron to become overloaded, especially when there are lots of items to be imported. It would be nice to run a separate drush command whenever we want as well as having the ability to disable the cron job from being run.

Proposed resolution

  • Provide control to enable/disable Brightcove from running during the normal cron via an admin settings page.
  • Create a drush command to run the "Sync all" batch operations separately.

Remaining tasks

User interface changes

  1. Added a "Brightcove Cron" admin settings page to manage the cron job - /admin/config/system/brightcove_cron

API changes

Data model changes

Comments

marknatividad created an issue. See original summary.

marknatividad’s picture

Adding the patch file.

marknatividad’s picture

Assigned: marknatividad » Unassigned
boobaa’s picture

Status: Needs review » Needs work
  1. +++ b/brightcove.module
    @@ -147,6 +147,13 @@ function _brightcove_initiate_sync() {
    +  $disable_cron = $config->get('disable_cron');
    +
    +  if (isset($disable_cron) && 1 === $disable_cron) {
    

    Since it's a checkbox on the UI, I think a simple if ($config->get('disable_cron')) {} would be enough.

  2. +++ b/src/Form/BrightcoveCronSettingsForm.php
    @@ -0,0 +1,53 @@
    +  /**
    

    Missing empty line here (per Drupal coding standards).

  3. +++ b/src/Form/BrightcoveCronSettingsForm.php
    @@ -0,0 +1,53 @@
    +      '#required' => FALSE
    

    This line is not needed.

  4. +++ b/src/Form/BrightcoveCronSettingsForm.php
    @@ -0,0 +1,53 @@
    +}
    

    Missing empty line here (per Drupal coding standards).

The only thing I'm missing a bit is the default configuration for this checkbox (in the config/install/brightcove.settings.yml file). Otherwise it looks great, thanks!

marknatividad’s picture

Re-adding a patch to include:

  1. fixes for code review items
  2. and added default configuration for the "Disable cron" checkbox in config/install/brightcove.settings.yml file
marknatividad’s picture

Status: Needs work » Needs review

  • Boobaa committed 18e94d9 on 8.x-1.x authored by marknatividad
    Issue #2886662 by marknatividad: Provide drush support for syncing and...
boobaa’s picture

Title: Provide drush support for syncing and control over cron » Provide drush support for syncing and control over cron
Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.