Skip to content

Commit

Permalink
Merge pull request #145 from snowplow/release/0.8.0
Browse files Browse the repository at this point in the history
Release/0.8.0
  • Loading branch information
matus-tomlein authored Dec 13, 2024
2 parents 5ffab25 + 3b845fe commit 67db749
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
22 changes: 20 additions & 2 deletions src/Emitters/CurlEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down
18 changes: 18 additions & 0 deletions tests/tests/EmitterTests/CurlEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 67db749

Please sign in to comment.