On a high traffic site, with either below two scenario:

1. live storage
2. deferred storage and multi-threaded cron

The energy saved in field gets set to zero now and then.

The root cause is that in updateEnergy method, the field sql storage performs a delete/insert rather than an update action, so there is chance that between the delete and insert action, another updateEnergy method would get an empty field data, and with code http://cgit.drupalcode.org/radioactivity/tree/radioactivity.module?id=14... , it will be given to a zero initial value.

Proposed Solution, use Drupal Queue for energy updating instead of a foreach in cron to ensure the order of the incidents processing.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

weynhamz created an issue. See original summary.

weynhamz’s picture

Title: Energy gets set to zero on high traffic sites now and then therwith live storage » Energy gets set to zero on high traffic sites now and then
weynhamz’s picture

Issue summary: View changes
weynhamz’s picture

OK,

Fixed the problem by following patches.

Patch 0001 Use Drupal Queue to update the energy, so that incident is guaranteed to be processed.

Patch 0002 Add a lock through variable system on updating the energy, this commit is obsolete, just keep it for historical purpose. The primary reason is that it does more than a lock, it also records whether the field is initiated, but it turns out on a decay profile, the field will always gets deleted, so it is useless. Also, use Variable system for locking could cause serous performance problems.

Patch 0003 Use Drupal builtin lock system, and it works.