mirror of
https://github.com/foomo/contentfulproxy.git
synced 2025-10-16 12:25:37 +00:00
* rename flush to update
This commit is contained in:
parent
75eaa4f19b
commit
23e1432203
@ -54,7 +54,7 @@ func (c *cache) get(id cacheID) (*cachedResponse, bool) {
|
||||
return response, ok
|
||||
}
|
||||
|
||||
func (c *cache) flush() {
|
||||
func (c *cache) update() {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
c.cacheMap = cacheMap{}
|
||||
|
||||
@ -111,8 +111,8 @@ func getLoop(
|
||||
for {
|
||||
select {
|
||||
case command := <-chanFlush:
|
||||
l.Info("cache flush command coming in", zap.String("flushCommand", string(command)))
|
||||
c.flush()
|
||||
l.Info("cache update command coming in", zap.String("flushCommand", string(command)))
|
||||
c.update()
|
||||
c.callWebHooks()
|
||||
case nextJob := <-chanRequestJob:
|
||||
id := getCacheIDForRequest(nextJob.request)
|
||||
|
||||
@ -15,7 +15,7 @@ const (
|
||||
responseFoo = `i am a foo response`
|
||||
responseBar = `i am bar response`
|
||||
responseUpdate = `update`
|
||||
responseFlush = `flush`
|
||||
responseFlush = `update`
|
||||
)
|
||||
|
||||
type getStats func(path string) int
|
||||
@ -72,7 +72,7 @@ func GetWebHook(t *testing.T) (getStats, http.HandlerFunc) {
|
||||
case "/update":
|
||||
w.Write([]byte(responseUpdate))
|
||||
return
|
||||
case "/flush":
|
||||
case "/update":
|
||||
w.Write([]byte(responseFlush))
|
||||
return
|
||||
}
|
||||
@ -96,7 +96,7 @@ func getTestServer(t *testing.T) (gs func(path string) int, ws func(path string)
|
||||
"",
|
||||
[]WebHookURL{
|
||||
WebHookURL(webHookServer.URL + "/update"),
|
||||
WebHookURL(webHookServer.URL + "/flush"),
|
||||
WebHookURL(webHookServer.URL + "/update"),
|
||||
},
|
||||
)
|
||||
s = httptest.NewServer(p)
|
||||
@ -135,6 +135,6 @@ func TestProxy(t *testing.T) {
|
||||
|
||||
//
|
||||
assert.Equal(t, 1, ws("/update"))
|
||||
assert.Equal(t, 1, ws("/flush"))
|
||||
assert.Equal(t, 1, ws("/update"))
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user