add limiter to the get all peers

This commit is contained in:
Maycon Santos
2025-05-07 23:21:00 +02:00
parent c5b065aec1
commit 489f13031b

View File

@@ -203,6 +203,10 @@ func (h *Handler) HandlePeer(w http.ResponseWriter, r *http.Request) {
// GetAllPeers returns a list of all peers associated with a provided account
func (h *Handler) GetAllPeers(w http.ResponseWriter, r *http.Request) {
if !h.rateLimiter.Allow() {
util.WriteError(r.Context(), fmt.Errorf("temp rate limit reached"), w)
return
}
userAuth, err := nbcontext.GetUserAuthFromContext(r.Context())
if err != nil {
util.WriteError(r.Context(), err, w)