ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

429 watchdog (#514)

* 429 watchdog

* fix text

---------

Co-authored-by: paul miller <paul.miller>

authored by

Paul Miller
paul miller
and committed by
GitHub
3083da3a 506bf29d

+2 -2
+1 -1
internal/watchdog/server.go
··· 39 39 mux.HandleFunc("GET /watchdogs/"+watcher.name, func(w http.ResponseWriter, r *http.Request) { 40 40 err := watcher.dog.Watchdog(r.Context()) 41 41 if errors.Is(err, errTooSoon) { 42 - http.Error(w, fmt.Sprintf("can only call watchdog every %v", watcher.period), http.StatusServiceUnavailable) 42 + http.Error(w, fmt.Sprintf("can only call watchdog every %v", watcher.period), http.StatusTooManyRequests) 43 43 return 44 44 } 45 45 if err != nil {
+1 -1
internal/watchdog/server_test.go
··· 40 40 41 41 second := httptest.NewRecorder() 42 42 mux.ServeHTTP(second, httptest.NewRequest(http.MethodGet, "/watchdogs/staples", nil)) 43 - if got, want := second.Code, http.StatusServiceUnavailable; got != want { 43 + if got, want := second.Code, http.StatusTooManyRequests; got != want { 44 44 t.Fatalf("second status = %d, want %d", got, want) 45 45 } 46 46 if !strings.Contains(second.Body.String(), "can only call watchdog every "+(6*time.Hour).String()) {