Skip to content

Commit

Permalink
fixing the skipped & dropped stats counting
Browse files Browse the repository at this point in the history
  • Loading branch information
d-led committed Oct 22, 2021
1 parent e0d0f5d commit 8811f4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 2 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ Notable changes will be documented here

## 0.9.28

- sample UI:
- showing the `/stats` results

## 0.9.27

- link-checker-service
- a simple `/stats` endpoint
- sample UI:
- showing the `/stats` results

## 0.9.26

Expand Down
6 changes: 4 additions & 2 deletions infrastructure/url_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,10 @@ func onCheckResult(res *URLCheckResult) {
case Broken:
s.OnLinkBroken()
case Dropped:
s.OnLinkDropped()
// handled in the drop handler
case Skipped:
s.OnLinkSkipped()
// handled in an upper layer
break
}
}

Expand Down Expand Up @@ -430,6 +431,7 @@ func normalizeAddressOf(input string) string {
func (c *URLCheckerClient) checkURL(ctx context.Context, urlToCheck string, client *resty.Client) (*URLCheckResult, bool) {
select {
case <-ctx.Done():
GlobalStats().OnLinkDropped()
return &URLCheckResult{
Status: Dropped,
Code: CustomHTTPErrorCode,
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ func translateCheckerTrace(trace []infrastructure.URLCheckerPluginTrace) []URLCh
}

func urlBlacklisted(url URLRequest) URLStatusResponse {
infrastructure.GlobalStats().OnLinkSkipped()
return URLStatusResponse{
URLRequest: url,
HTTPStatus: infrastructure.CustomHTTPErrorCode,
Expand Down

0 comments on commit 8811f4b

Please sign in to comment.