GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Log test statistics after each request.

parent 05304cc5
......@@ -4,12 +4,13 @@ import (
"encoding/json"
"errors"
"fmt"
"golang.org/x/time/rate"
"io/ioutil"
"log"
"net/http"
"path"
"time"
"golang.org/x/time/rate"
)
var IndexPage string
......@@ -122,6 +123,22 @@ func testBridgeLines(bridgeLines []string) *TestResult {
log.Printf("All %d bridge lines served from cache. No need for testing.", numCached)
}
// Log fraction of bridges that are functional.
numFunctional, numDysfunctional := 0, 0
for _, bridgeTest := range result.Bridges {
if bridgeTest.Functional {
numFunctional++
} else {
numDysfunctional++
}
}
log.Printf("Tested %d bridges: %d (%.1f%%) functional; %d (%.1f%%) dysfunctional.",
len(result.Bridges),
numFunctional,
float64(numFunctional)/float64(len(result.Bridges))*100,
numDysfunctional,
float64(numDysfunctional)/float64(len(result.Bridges))*100)
return result
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment