Merge branch 'better_eta' into develop

This commit is contained in:
Neil Booth 2016-11-05 18:49:08 +09:00
commit c91f315482
2 changed files with 9 additions and 6 deletions

View File

@ -275,5 +275,4 @@ After flush-to-disk you may see an aiohttp error; this is the daemon
timing out the connection while the disk flush was in progress. This timing out the connection while the disk flush was in progress. This
is harmless. is harmless.
The ETA is just a guide and can be quite volatile, particularly around The ETA is just a guide and can be quite volatile around flushes.
flushes. It is too optimistic initially.

View File

@ -609,8 +609,8 @@ class BlockProcessor(LoggedClass):
# Catch-up stats # Catch-up stats
if show_stats: if show_stats:
daemon_height = self.daemon.cached_height() daemon_height = self.daemon.cached_height()
txs_per_sec = int(self.tx_count / self.wall_time) tx_per_sec = int(self.tx_count / self.wall_time)
this_txs_per_sec = 1 + int(tx_diff / (self.last_flush - last_flush)) this_tx_per_sec = 1 + int(tx_diff / (self.last_flush - last_flush))
if self.height > self.coin.TX_COUNT_HEIGHT: if self.height > self.coin.TX_COUNT_HEIGHT:
tx_est = (daemon_height - self.height) * self.coin.TX_PER_BLOCK tx_est = (daemon_height - self.height) * self.coin.TX_PER_BLOCK
else: else:
@ -618,12 +618,16 @@ class BlockProcessor(LoggedClass):
* self.coin.TX_PER_BLOCK * self.coin.TX_PER_BLOCK
+ (self.coin.TX_COUNT - self.tx_count)) + (self.coin.TX_COUNT - self.tx_count))
# Damp the enthusiasm
realism = 2.0 - 0.9 * self.height / self.coin.TX_COUNT_HEIGHT
tx_est *= max(realism, 1.0)
self.logger.info('tx/sec since genesis: {:,d}, ' self.logger.info('tx/sec since genesis: {:,d}, '
'since last flush: {:,d}' 'since last flush: {:,d}'
.format(txs_per_sec, this_txs_per_sec)) .format(tx_per_sec, this_tx_per_sec))
self.logger.info('sync time: {} ETA: {}' self.logger.info('sync time: {} ETA: {}'
.format(formatted_time(self.wall_time), .format(formatted_time(self.wall_time),
formatted_time(tx_est / this_txs_per_sec))) formatted_time(tx_est / this_tx_per_sec)))
def flush_history(self, batch): def flush_history(self, batch):
self.logger.info('flushing history') self.logger.info('flushing history')