Adds HTTP Get rate limitation on cache
We don't want to have a large bandwidth on bedetheque.com, so the pace at which we perform GET request is limited by a maximal number of request over a window (per example no more than 10 request over 10 second) If more request are required, the request is simply paused until we go back within the limit ;). Go rulez !
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
@@ -30,7 +31,7 @@ func (s *AlbumDescriptionCacheSuite) TestCanFetchCache(c *C) {
|
||||
c.Assert(err, IsNil)
|
||||
defer os.RemoveAll(tmpdir)
|
||||
|
||||
cache, err := NewAlbumDescriptionCache(tmpdir)
|
||||
cache, err := NewAlbumDescriptionCache(tmpdir, 10, 10*time.Second)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
for ID, expected := range data {
|
||||
|
||||
Reference in New Issue
Block a user