In function _css_injector_load_rule, empty($cache->data)evaluates to FALSE if cache_get('css_injector:rules') returns an empty array.

That leads to the execution of the second part of the structure, which does an unnecessary DB query and cache_set(), which in turn have a negative impact on performance.

I would suggest to remove that condition, or replace it by is_array($cache->data), though I am not sure why it was added in the first place.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jfhovinne created an issue. See original summary.

jfhovinne’s picture

Status: Active » Needs review
FileSize
742 bytes

Here is the patch.

jfhovinne’s picture

Assigned: jfhovinne » Unassigned
jfhovinne’s picture

Removed the annoying 'No newline at end of file' which causes a conflict during our profile build.

oresh’s picture

@jfhovinne thanks for your patch! I'll take a look and include the fix in the 7.1 dev

oresh’s picture

Assigned: Unassigned » oresh

  • oresh committed 11b2dab on 7.x-1.x authored by jfhovinne
    Issue #2759319 by jfhovinne: Unnecessary DB query and cache_set when...
jfhovinne’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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