From 62882ab8fe7a683d7704239e79893e70cbe80fdd Mon Sep 17 00:00:00 2001 From: Ely Deckers Date: Mon, 21 Feb 2022 09:22:09 +0100 Subject: [PATCH] Replace magic numbers with constants --- pfsense_zbx.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pfsense_zbx.php b/pfsense_zbx.php index 4f03af9..d3400b9 100644 --- a/pfsense_zbx.php +++ b/pfsense_zbx.php @@ -40,6 +40,8 @@ define("TEXT_RESERVED", gettext("reserved")); const SPEED_TEST_INTERVAL_HOURS = 8; const SPEED_TEST_INTERVAL_SECONDS = SPEED_TEST_INTERVAL_HOURS * 3600; +const SPEED_TEST_RANDOM_DELAY_MIN_SECONDS = 1; +const SPEED_TEST_RANDOM_DELAY_MAX_SECONDS = 90; const FALLBACK_VALUE = 0; @@ -588,7 +590,7 @@ class SpeedTest // Issue #82 // Sleep random delay in order to avoid problem when 2 pfSense on the same Internet line - sleep(rand(1, 90)); + sleep(rand(SPEED_TEST_RANDOM_DELAY_MIN_SECONDS, SPEED_TEST_RANDOM_DELAY_MAX_SECONDS)); $is_output_file_older_than_interval = !file_exists($output_file_path) ||