You are here

Node import locking functions in Node import 6

Locking functions for node_import. This code is based on #251792 (Implement a locking framework for long operations). We need locking to avoid both hook_cron() and node_import_view_form() to process the same task at the same time (which would result in rows being processed twice).

The code below uses the database-based locking mechanism. Note that is does not use the full implementation as in the patch because we can have only one global lock. One lock for each task does not work because a task can spawn the creation of something else (such as a taxonomy term).

We only need one _acquire() and _release() function.

When a more general locking framework is committed to Drupal, we can easily replace this.

File

./node_import.inc, line 2156
Public API of the Node import module.

Functions

Namesort descending Location Description
node_import_lock_acquire ./node_import.inc Acquire or release our node_import lock.
node_import_lock_release ./node_import.inc Release our node_import lock.