diff options
| author | Fuwn <[email protected]> | 2026-01-19 04:17:50 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-19 04:17:50 -0800 |
| commit | 1e96ec397d38e6263c5369d91f2579092c9c9390 (patch) | |
| tree | b4b73accb870de9178acc931443c8cd474423fa5 /internal/monitor/http.go | |
| parent | feat: Add browser timezone option for client-side time display (diff) | |
| download | kaze-1e96ec397d38e6263c5369d91f2579092c9c9390.tar.xz kaze-1e96ec397d38e6263c5369d91f2579092c9c9390.zip | |
feat: Add retry option for monitor checks
Diffstat (limited to 'internal/monitor/http.go')
| -rw-r--r-- | internal/monitor/http.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/monitor/http.go b/internal/monitor/http.go index 8432401..5587a5f 100644 --- a/internal/monitor/http.go +++ b/internal/monitor/http.go @@ -20,6 +20,7 @@ type HTTPMonitor struct { target string interval time.Duration timeout time.Duration + retries int method string headers map[string]string body string @@ -81,6 +82,7 @@ func NewHTTPMonitor(cfg config.MonitorConfig) (*HTTPMonitor, error) { target: target, interval: cfg.Interval.Duration, timeout: cfg.Timeout.Duration, + retries: cfg.Retries, method: cfg.Method, headers: cfg.Headers, body: cfg.Body, @@ -110,6 +112,11 @@ func (m *HTTPMonitor) Interval() time.Duration { return m.interval } +// Retries returns the number of retry attempts +func (m *HTTPMonitor) Retries() int { + return m.retries +} + // Check performs the HTTP/HTTPS check func (m *HTTPMonitor) Check(ctx context.Context) *Result { result := &Result{ |