Skip to content

Commit

Permalink
avoid duplicate requests to the cache proxy. fix #125
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Sep 1, 2014
1 parent 1e0a515 commit a76b98d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ProxyClient/AbstractProxyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ public function flush()
*/
protected function queueRequest($method, $url, array $headers = array())
{
$this->queue[] = $this->createRequest($method, $url, $headers);
$signature = md5($method . "\n" . $url . "\n" . implode("\n", $headers));
if (!isset($this->queue[$signature])) {
$this->queue[$signature] = $this->createRequest($method, $url, $headers);
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/ProxyClient/VarnishTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ function ($requests) use ($self) {
$varnish
->purge('/c')
->purge('/b')
->purge('/b')
->purge('/b')
->flush()
);
}
Expand Down

0 comments on commit a76b98d

Please sign in to comment.