diff --git a/CHANGELOG b/CHANGELOG index c4420b0..18d5049 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Version 0.8.0 (2024-12-12) +-------------------------- +Add setCurlAmount and setRollingWindow setters to CurlEmitter + Version 0.7.1 (2024-05-15) -------------------------- Log the file name in errors from emitter (#143) thanks to @kaurov diff --git a/src/Constants.php b/src/Constants.php index e6f4cd0..dee620b 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -45,7 +45,7 @@ class Constants { * - SSL: the default for whether or not to use SSL Encryption * - Type: the default for what type of request the emitter will be making (POST or GET) */ - const TRACKER_VERSION = "php-0.7.1"; + const TRACKER_VERSION = "php-0.8.0"; const DEFAULT_BASE_64 = true; const DEBUG_LOG_FILES = true; const CONTEXT_SCHEMA = "iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-1"; diff --git a/src/Emitters/CurlEmitter.php b/src/Emitters/CurlEmitter.php index 21da6c4..aced2fe 100644 --- a/src/Emitters/CurlEmitter.php +++ b/src/Emitters/CurlEmitter.php @@ -304,7 +304,16 @@ public function returnCurlBuffer() { } /** - * Returns the amount of curls we need before sending + * Set the amount of times we need to reach the buffer limit (buffer_size) before we initiate sending + * + * @param int $curl_limit + */ + public function setCurlAmount($curl_limit) { + $this->curl_limit = $curl_limit; + } + + /** + * Returns the amount of times we need to reach the buffer limit (buffer_size) before we initiate sending * * @return int */ @@ -313,7 +322,16 @@ public function returnCurlAmount() { } /** - * Returns the amount of simultaneous curls we send + * Set the max amount of concurrent curl requests being made + * + * @param int $rolling_window + */ + public function setRollingWindow($rolling_window) { + $this->rolling_window = $rolling_window; + } + + /** + * Returns the max amount of concurrent curl requests being made * * @return int */ diff --git a/tests/tests/EmitterTests/CurlEmitterTest.php b/tests/tests/EmitterTests/CurlEmitterTest.php index d03c29a..bce6cf4 100644 --- a/tests/tests/EmitterTests/CurlEmitterTest.php +++ b/tests/tests/EmitterTests/CurlEmitterTest.php @@ -140,4 +140,22 @@ public function testReturnFunctions() { $this->assertEquals(10, $emitter->returnRollingWindow()); } + + public function testSetRollingWindow() { + $tracker = $this->returnTracker("POST", false, $this->uri); + $emitters = $tracker->returnEmitters(); + $emitter = $emitters[0]; + + $emitter->setRollingWindow(32); + $this->assertEquals(32, $emitter->returnRollingWindow()); + } + + public function testSetCurlAmount() { + $tracker = $this->returnTracker("POST", false, $this->uri); + $emitters = $tracker->returnEmitters(); + $emitter = $emitters[0]; + + $emitter->setCurlAmount(12); + $this->assertEquals(12, $emitter->returnCurlAmount()); + } }