File tree Expand file tree Collapse file tree 3 files changed +9
-19
lines changed Expand file tree Collapse file tree 3 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -6,28 +6,24 @@ extension ServerTour.Stats
6
6
public
7
7
var siteMap : Int
8
8
public
9
- var restricted : Int
10
- public
11
9
var query : Int
12
10
public
13
11
var other : Int
14
12
15
13
@inlinable public
16
14
init ( siteMap: Int = 0 ,
17
- restricted: Int = 0 ,
18
15
query: Int = 0 ,
19
16
other: Int = 0 )
20
17
{
21
18
self . siteMap = siteMap
22
- self . restricted = restricted
23
19
self . query = query
24
20
self . other = other
25
21
}
26
22
}
27
23
}
28
24
extension ServerTour . Stats . ByType
29
25
{
30
- /// The total count, except for the ``restricted`` type .
26
+ /// The total count.
31
27
@inlinable public
32
28
var total : Int
33
29
{
Original file line number Diff line number Diff line change @@ -11,13 +11,6 @@ protocol RestrictedOperation:InteractiveOperation
11
11
func load( from state: Server . State ) async throws -> ServerResponse ?
12
12
}
13
13
extension RestrictedOperation
14
- {
15
- var statisticalType : WritableKeyPath < ServerTour . Stats . ByType , Int >
16
- {
17
- \. restricted
18
- }
19
- }
20
- extension RestrictedOperation
21
14
{
22
15
static
23
16
func admit( _ role: Account . Role ) -> Bool
Original file line number Diff line number Diff line change @@ -50,16 +50,17 @@ extension Server.State
50
50
content: . string( " not found " ) ,
51
51
type: . text( . plain, charset: . utf8) ) )
52
52
53
- self . tour. stats. requests [ keyPath: type] += 1
53
+ // Don’t increment stats from administrators,
54
+ // they will really skew the results.
55
+ if case nil = request. cookies. session
56
+ {
57
+ self . tour. stats. requests [ keyPath: type] += 1
58
+ self . tour. stats. bytes [ keyPath: type] += response. size
54
59
55
- let status : WritableKeyPath < ServerTour . Stats . ByStatus , Int > =
56
- response. statisticalStatus
60
+ let status : WritableKeyPath < ServerTour . Stats . ByStatus , Int > =
61
+ response. statisticalStatus
57
62
58
- // Don’t count visits to the admin tools.
59
- if type != \. restricted
60
- {
61
63
self . tour. stats. responses [ keyPath: status] += 1
62
- self . tour. stats. bytes [ keyPath: type] += response. size
63
64
}
64
65
65
66
request. promise. succeed ( response)
You can’t perform that action at this time.
0 commit comments