We have a very customised configuration and our test environments are not on Acquia so understand if this isn't supported but we're running into division by zero errors when running test which programatically create nodes.

Would it be possible to include the following patch so the slowdown_factor can never be zero?

Have put priority to minor as this is only an issue on non Acquia environments.

Comments

elijah lynn’s picture

Could you use a post sql-sync hook that disables the Acquia Purge module?

If it is a local environment you could look at Drush Rebuild, https://www.drupal.org/project/rebuild, use the dev version.

elijah lynn’s picture

Wait, are you actually using Acquia Purge functionality on these test environments in a mock kind of way or do you just want it disabled?

8thom’s picture

Our preference would be to keep it enabled as we want our test environment to be a close as production,
so some way to configure it to fail gracefully on non Acquia environments would be best.

mattew’s picture

+1 Acquia Purge should test the $factor value properly before trying to divide by zero...

Acquia Purge may not be disabled because it could be a dependence of other modules, likes features, in case we use Rules for example.

nielsvm’s picture

Status: Active » Closed (fixed)

Agreed gentlemen, patched it almost similarly and verified the lack of errors now locally. Expect this one for 7.x-1.2.

nvmourik ~/src/acquia_purge (7.x-1.x *+)$ git commit
[7.x-1.x 9ffc80d] Prevent division-by-zero errors.
diff --git a/acquia_purge.module b/acquia_purge.module
index 3c971f6..7bc1382 100644
--- a/acquia_purge.module
+++ b/acquia_purge.module
@@ -645,6 +645,13 @@ function _acquia_purge_get_capacity_factor() {
 
     // Multiply all configuration actors with each other.
     $slowdown_factor = $schemes * $domains * $balancers;
+
+    // When running outside of Acquia Cloud, the factor could become 0 and since
+    // we don't need division-by-zero bugs everywhere, we'd make it 1. Module
+    // won't work anyway so this cannot be a big deal.
+    if ($slowdown_factor === 0) {
+      $slowdown_factor = 1;
+    }
   }
   return $slowdown_factor;
 }
frankcarey’s picture

Can we get a new release pushed with this fix?

afoster’s picture

StatusFileSize
new252.5 KB

Thanks for the patch - Tested and works.

Can anyone suggest how to disable this numerous warnings on every node save?
Error message

I'm disabling all caching on local dev in my settings.local.php, would is be possible to something similar to disable the numerous warnings with acquia purge?

8thom’s picture

A global disable setting would be very handy -- I've just had a site go down when running a drush import that updates about 11000 nodes

nielsvm’s picture

Hi all,

I released 7.x-1.2-beta1 yesterday, which contains this fix:
https://www.drupal.org/node/2499643

I'm disabling all caching on local dev in my settings.local.php, would is be possible to something similar to disable the numerous warnings with acquia purge?

Don't disable anything else besides enabling passive mode, so, all you need is:
$conf['acquia_purge_passivemode'] = TRUE;

A global disable setting would be very handy -- I've just had a site go down when running a drush import that updates about 11000 nodes

Please have a look at $conf['acquia_purge_errorlimit'], this now does what you want (if you really want it).

Nonetheless - please file new tickets for continuing tickets, since the division-by-zero this issue was about is fixed. Though reopen if it would come back!

Thanks,
Niels