Skip to content

Commit 9631f86

Browse files
authored
example code bug fix
example code bug fix ``` limiter := rate.NewLimiter(ring) // Optional. limiter.Fallback = timerate.NewLimiter(rate.Every(time.Second), 100) ``` ``` limiter := redis_rate.NewLimiter(ring) // Optional. limiter.Fallback = rate.NewLimiter(rate.Every(time.Second), 100) ```
1 parent 31124b3 commit 9631f86

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ func main() {
5454
"server1": "localhost:6379",
5555
},
5656
})
57-
limiter := rate.NewLimiter(ring)
58-
// Optional.
59-
limiter.Fallback = timerate.NewLimiter(rate.Every(time.Second), 100)
57+
limiter := redis_rate.NewLimiter(ring)
58+
// Optional.
59+
limiter.Fallback = rate.NewLimiter(rate.Every(time.Second), 100)
6060

61-
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
62-
handler(w, req, limiter)
63-
})
61+
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
62+
handler(w, req, limiter)
63+
})
6464

65-
http.HandleFunc("/status", func(w http.ResponseWriter, req *http.Request) {
66-
statusHandler(w, req, limiter)
67-
})
65+
http.HandleFunc("/status", func(w http.ResponseWriter, req *http.Request) {
66+
statusHandler(w, req, limiter)
67+
})
6868

69-
http.HandleFunc("/favicon.ico", http.NotFound)
70-
log.Println("listening on localhost:8888...")
71-
log.Println(http.ListenAndServe("localhost:8888", nil))
69+
http.HandleFunc("/favicon.ico", http.NotFound)
70+
log.Println("listening on localhost:8888...")
71+
log.Println(http.ListenAndServe("localhost:8888", nil))
7272
}
7373
```

0 commit comments

Comments
 (0)