Skip to content

Commit 6361989

Browse files
matus-tomleinJack-Keene
authored andcommitted
Add setCurlAmount and setRollingWindow setters to CurlEmitter
1 parent 07e5908 commit 6361989

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/Emitters/CurlEmitter.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,16 @@ public function returnCurlBuffer() {
304304
}
305305

306306
/**
307-
* Returns the amount of curls we need before sending
307+
* Set the amount of times we need to reach the buffer limit (buffer_size) before we initiate sending
308+
*
309+
* @param int $curl_limit
310+
*/
311+
public function setCurlAmount($curl_limit) {
312+
$this->curl_limit = $curl_limit;
313+
}
314+
315+
/**
316+
* Returns the amount of times we need to reach the buffer limit (buffer_size) before we initiate sending
308317
*
309318
* @return int
310319
*/
@@ -313,7 +322,16 @@ public function returnCurlAmount() {
313322
}
314323

315324
/**
316-
* Returns the amount of simultaneous curls we send
325+
* Set the max amount of concurrent curl requests being made
326+
*
327+
* @param int $rolling_window
328+
*/
329+
public function setRollingWindow($rolling_window) {
330+
$this->rolling_window = $rolling_window;
331+
}
332+
333+
/**
334+
* Returns the max amount of concurrent curl requests being made
317335
*
318336
* @return int
319337
*/

tests/tests/EmitterTests/CurlEmitterTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,22 @@ public function testReturnFunctions() {
140140
$this->assertEquals(10,
141141
$emitter->returnRollingWindow());
142142
}
143+
144+
public function testSetRollingWindow() {
145+
$tracker = $this->returnTracker("POST", false, $this->uri);
146+
$emitters = $tracker->returnEmitters();
147+
$emitter = $emitters[0];
148+
149+
$emitter->setRollingWindow(32);
150+
$this->assertEquals(32, $emitter->returnRollingWindow());
151+
}
152+
153+
public function testSetCurlAmount() {
154+
$tracker = $this->returnTracker("POST", false, $this->uri);
155+
$emitters = $tracker->returnEmitters();
156+
$emitter = $emitters[0];
157+
158+
$emitter->setCurlAmount(12);
159+
$this->assertEquals(12, $emitter->returnCurlAmount());
160+
}
143161
}

0 commit comments

Comments
 (0)