The module uses a variable to store state which results in 2 variable_sets which invalidate the cache table. The tracking to attach the JS or not in the theme can be done using a static variable which removes the need to store a variable in cache fo the lifetime of page. Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

voxpelli’s picture

Title: variable incorrectly used to store state » Variable misused used to store state
Category: feature » bug
Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community
FileSize
1.29 KB

This is a pretty critical issue since a variable_set() saves the data to the database as well as clears the variable cache - which results in more pressure on the database.

Plus1 make one database write on every page load as well as one more database write when a widget is shown - which is totally unnecessary and harms performance.

I reviewed the patch - it's pretty basic and it works. I'm attaching a version where I changed the name of the variable to be more descriptive.

NancyDru’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
NancyDru’s picture

Status: Patch (to be ported) » Fixed

Committed to 6.x-2.x-dev.

Status: Fixed » Closed (fixed)

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