Improve logging
This commit is contained in:
parent
a30932fc86
commit
1ebebf08d9
@ -191,12 +191,12 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
|
|||||||
|
|
||||||
def pause_writing(self):
|
def pause_writing(self):
|
||||||
'''Called by asyncio when the write buffer is full.'''
|
'''Called by asyncio when the write buffer is full.'''
|
||||||
self.log_info('pausing writing')
|
self.log_info('pausing request processing whilst socket drains')
|
||||||
self.pause = True
|
self.pause = True
|
||||||
|
|
||||||
def resume_writing(self):
|
def resume_writing(self):
|
||||||
'''Called by asyncio when the write buffer has room.'''
|
'''Called by asyncio when the write buffer has room.'''
|
||||||
self.log_info('resuming writing')
|
self.log_info('resuming request processing')
|
||||||
self.pause = False
|
self.pause = False
|
||||||
|
|
||||||
def close_connection(self):
|
def close_connection(self):
|
||||||
|
|||||||
@ -199,7 +199,11 @@ class BlockProcessor(server.db.DB):
|
|||||||
break
|
break
|
||||||
blocks = self.prefetcher.get_blocks()
|
blocks = self.prefetcher.get_blocks()
|
||||||
if blocks:
|
if blocks:
|
||||||
|
start = time.time()
|
||||||
await self.advance_blocks(blocks, touched)
|
await self.advance_blocks(blocks, touched)
|
||||||
|
s = '' if len(blocks) == 1 else 's'
|
||||||
|
self.logger.info('processed {:,d} block{} in {:.1f}s'
|
||||||
|
.format(len(blocks), s, time.time() - start))
|
||||||
elif not self.caught_up:
|
elif not self.caught_up:
|
||||||
self.caught_up = True
|
self.caught_up = True
|
||||||
self.first_caught_up()
|
self.first_caught_up()
|
||||||
|
|||||||
@ -161,7 +161,8 @@ class ServerManager(util.LoggedClass):
|
|||||||
excess = priority - self.BANDS
|
excess = priority - self.BANDS
|
||||||
if excess > 0:
|
if excess > 0:
|
||||||
secs = excess
|
secs = excess
|
||||||
session.log_info('delaying response {:d}s'.format(secs))
|
session.log_info('delaying response to low-priority session {:d}s'
|
||||||
|
.format(secs))
|
||||||
if secs:
|
if secs:
|
||||||
self.delayed_sessions.append((time.time() + secs, item))
|
self.delayed_sessions.append((time.time() + secs, item))
|
||||||
else:
|
else:
|
||||||
@ -334,8 +335,9 @@ class ServerManager(util.LoggedClass):
|
|||||||
group = self.groups[int(session.start - self.start) // 900]
|
group = self.groups[int(session.start - self.start) // 900]
|
||||||
group.add(session)
|
group.add(session)
|
||||||
self.sessions[session] = group
|
self.sessions[session] = group
|
||||||
session.log_info('connection from {}, {:,d} total'
|
session.log_info('{} from {}, {:,d} total'
|
||||||
.format(session.peername(), len(self.sessions)))
|
.format(session.kind, session.peername(),
|
||||||
|
len(self.sessions)))
|
||||||
if (len(self.sessions) >= self.max_sessions
|
if (len(self.sessions) >= self.max_sessions
|
||||||
and self.state == self.LISTENING):
|
and self.state == self.LISTENING):
|
||||||
self.state = self.PAUSED
|
self.state = self.PAUSED
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user