Skip to content

Commit a76b98d

Browse files
committed
avoid duplicate requests to the cache proxy. fix #125
1 parent 1e0a515 commit a76b98d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/ProxyClient/AbstractProxyClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ public function flush()
130130
*/
131131
protected function queueRequest($method, $url, array $headers = array())
132132
{
133-
$this->queue[] = $this->createRequest($method, $url, $headers);
133+
$signature = md5($method . "\n" . $url . "\n" . implode("\n", $headers));
134+
if (!isset($this->queue[$signature])) {
135+
$this->queue[$signature] = $this->createRequest($method, $url, $headers);
136+
}
134137
}
135138

136139
/**

tests/Unit/ProxyClient/VarnishTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ function ($requests) use ($self) {
347347
$varnish
348348
->purge('/c')
349349
->purge('/b')
350+
->purge('/b')
351+
->purge('/b')
350352
->flush()
351353
);
352354
}

0 commit comments

Comments
 (0)