This commit is contained in:
Bel LaPointe
2019-02-23 19:04:12 -07:00
parent 2099ae50c6
commit 3961623373
4 changed files with 12 additions and 4 deletions

View File

@@ -87,7 +87,6 @@ func (s *Server) doAuth(foo http.HandlerFunc) http.HandlerFunc {
func (s *Server) Pre(foo http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx, can := context.WithTimeout(r.Context(), time.Second*time.Duration(config.GetTimeout()))
log.Printf("context iwth tiemout: %v", time.Second*time.Duration(config.GetTimeout()))
defer can()
if err := s.limiter.Wait(ctx); err != nil {
w.WriteHeader(http.StatusTooManyRequests)