Browse Source

Publish: removed transaction caching.

Lacey Sanderson 6 years ago
parent
commit
0a2637715e

+ 0 - 2
tripal/includes/TripalEntity.inc

@@ -21,8 +21,6 @@ class TripalEntity extends Entity {
    * @param $cache
    *   This array is used to store objects you want to cache for performance reasons,
    *   as well as, cache related options. The following are supported:
-   *   - DatabaseTransaction $transaction
-   *       Allows you to pass in your current transaction to save nested transaction overhead.
    *   - boolean $clear_cached_fields
    *       Clearing cached fields is NECESSARY. IF you choose to set this to false then YOU
    *       must clear the cache yourself using cache_clear_all('field:TripalEntity:[entity_id]', 'cache_field', TRUE).

+ 1 - 3
tripal/includes/TripalEntityController.inc

@@ -355,8 +355,6 @@ class TripalEntityController extends EntityAPIController {
    * @param $cache
    *   This array is used to store objects you want to cache for performance reasons,
    *   as well as, cache related options. The following are supported:
-   *   - DatabaseTransaction $transaction
-   *       Allows you to pass in your current transaction to save nested transaction overhead.
    *   - boolean $clear_cached_fields
    *       Clearing cached fields is NECESSARY. IF you choose to set this to false then YOU
    *       must clear the cache yourself using cache_clear_all('field:TripalEntity:[entity_id]', 'cache_field', TRUE).
@@ -391,7 +389,7 @@ class TripalEntityController extends EntityAPIController {
       }
     }
 
-    $transaction = isset($cache['transaction']) ? $cache['transaction'] : db_transaction();
+    $transaction = db_transaction();
     try {
       // If our entity has no id, then we need to give it a
       // time of creation.

+ 5 - 1
tripal_chado/api/tripal_chado.api.inc

@@ -231,8 +231,12 @@ function chado_publish_records($values, $job_id = NULL) {
         $total_published, $count, $complete * 3, number_format(memory_get_usage()), number_format((microtime(true) - $started_at)/60, 2));
     }
 
+    // There is no need to cache transactions since Drupal handles nested transactions
+    // "by performing no transactional operations (as far as the database sees) within
+    // the inner nesting layers". Effectively, Drupal ensures nested trasactions work the
+    // same as passing a transaction through to the deepest level and not starting a new
+    // transaction if we are already in one.
     $transaction = db_transaction();
-    $cache['transaction'] = $transaction;
 
     try {
       $i = 0;