File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 12
12
# message is missing after n have been received, it is assumed lost.
13
13
14
14
class CheckMid :
15
- def __init__ (self , buff = 5 ):
15
+ def __init__ (self , buff = 10 ):
16
16
self ._buff = buff
17
17
self ._mids = set ()
18
18
self .miss = 0 # Count missing message ID's
19
19
self .dupe = 0 # Duplicates
20
20
self .oord = 0 # Received out of order
21
- self .bcnt = 0 # Reboot count
21
+ self .bcnt = 0 # Client reboot count. Running totals over reboots:
22
+ self .tot_miss = 0 # Missing
23
+ self .tot_dupe = 0 # Dupes
24
+ self .tot_oord = 0 # Out of order
22
25
23
26
def __call__ (self , mid ):
24
27
mids = self ._mids
25
28
if mid <= 1 and len (mids ) > 1 : # Target has rebooted
26
29
self ._mids .clear ()
30
+ self .tot_miss += self .miss
31
+ self .tot_dupe += self .dupe
32
+ self .tot_oord += self .oord
27
33
self .miss = 0
28
34
self .dupe = 0
29
35
self .oord = 0
Original file line number Diff line number Diff line change @@ -52,8 +52,9 @@ async def start(self):
52
52
outages = self .conn .nconns - 1
53
53
ut = (time .time () - st ) / 3600 # Uptime in hrs
54
54
print ('Uptime {:6.2f}hr outages {}' .format (ut , outages ))
55
- print ('Dupes ignored {} local {} remote. ' .format (cm .dupe , data [3 ]), end = '' )
56
- print ('Missed msg {} local {} remote.' .format (cm .miss , data [4 ]))
55
+ print ('Dupes ignored {} local {} remote. ' .format (cm .tot_dupe , data [3 ]), end = '' )
56
+ print ('Missed msg {} local {} remote.' .format (cm .tot_miss , data [4 ]), end = '' )
57
+ print ('Client reboots' , cm .bcnt )
57
58
58
59
async def reader (self ):
59
60
print ('Started reader' )
Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ async def start(self):
54
54
outages = self .conn .nconns - 1
55
55
ut = (time .time () - st ) / 3600 # Uptime in hrs
56
56
print ('Uptime {:6.2f}hr outages {}' .format (ut , outages ))
57
- print ('Dupes ignored {} local {} remote. ' .format (cm .dupe , data [3 ]), end = '' )
58
- print ('Missed msg {} local {} remote.' .format (cm .miss , data [4 ]))
57
+ print ('Dupes ignored {} local {} remote. ' .format (cm .tot_dupe , data [3 ]), end = '' )
58
+ print ('Missed msg {} local {} remote.' .format (cm .tot_miss , data [4 ]), end = '' )
59
+ print ('Client reboots' , cm .bcnt )
59
60
60
61
async def reader (self ):
61
62
print ('Started reader' )
62
- cm = CheckMid () # Check message ID's for dupes, missing etc.
63
63
while True :
64
64
line = await self .conn .readline () # Pause in event of outage
65
65
data = json .loads (line )
You can’t perform that action at this time.
0 commit comments