Commit 873eb8fb authored by Youri van Koppen's avatar Youri van Koppen
Browse files

Issue #3193610 by MegaChriz: Fixed items getting unpublished/deleted...

Issue #3193610 by MegaChriz: Fixed items getting unpublished/deleted unexpectedly: extend the feed lock after 12 hours in case an import appears to be still active.
parent cbb7c8d0
Loading
Loading
Loading
Loading
+1 −0
Changes for config/install/feeds.settings.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
lock_timeout: 43200
+10 −0
Changes for config/schema/feeds.schema.yml: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Feeds global settings.
feeds.settings:
  type: config_object
  label: 'Feeds settings'
  mapping:
    lock_timeout:
      type: integer
      label: 'Feed lock timeout'

# Feed type configuration.
feeds.feed_type.*:
  type: config_entity
  label: 'Feed type'
+17 −0
Changes for feeds.install: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -133,3 +133,20 @@ function feeds_update_8003() {
function feeds_update_8004() {
  drupal_flush_all_caches();
}

/**
 * Set the default lock timeout for Feeds imports.
 */
function feeds_update_8005() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory->getEditable('feeds.settings');
  $config->set('lock_timeout', 43200);
  $config->save(TRUE);
}

/**
 * Flush all caches to make the service "feeds.lock" available.
 */
function feeds_update_8006() {
  drupal_flush_all_caches();
}
+4 −2
Changes for feeds.module: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -101,10 +101,12 @@ function feeds_cron() {
    }
  }

  // Delete queued timestamp after 12 hours assuming the update has failed.
  // Delete queued timestamp after some time assuming the update has failed.
  // By default this is 12 hours, equal to the timeout set for locking a feed.
  $timeout = \Drupal::config('feeds.settings')->get('lock_timeout') ?? 3600 * 12;
  $ids = \Drupal::entityQuery('feeds_feed')
    ->accessCheck(FALSE)
    ->condition('queued', \Drupal::time()->getRequestTime() - (3600 * 12), '<')
    ->condition('queued', \Drupal::time()->getRequestTime() - $timeout, '<')
    ->condition('queued', 0, '<>')
    ->execute();

+5 −0
Changes for feeds.services.yml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@ services:
  feeds.entity_finder:
    class: Drupal\feeds\EntityFinder
    arguments: ['@entity_type.manager', '@entity.repository']
  feeds.lock:
    class: Drupal\feeds\Lock\FeedsLockBackend
    arguments: ['@database', '@entity_type.manager', '@config.factory']
    tags:
      - { name: backend_overridable }

  feeds_plugin_form_factory:
    class: Drupal\feeds\Plugin\PluginFormFactory
Loading