Commit 76c75e37 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Added debug option which allows to skip After Initial Sync phase.

parent 49e8d13a
...@@ -58,6 +58,7 @@ class Conf(): ...@@ -58,6 +58,7 @@ class Conf():
add('--log-level', env_var='LOG_LEVEL', default='INFO') add('--log-level', env_var='LOG_LEVEL', default='INFO')
add('--test-disable-sync', type=strtobool, env_var='TEST_DISABLE_SYNC', help='(debug) skip sync and sweep; jump to block streaming', default=False) add('--test-disable-sync', type=strtobool, env_var='TEST_DISABLE_SYNC', help='(debug) skip sync and sweep; jump to block streaming', default=False)
add('--test-max-block', type=int, env_var='TEST_MAX_BLOCK', help='(debug) only sync to given block, for running sync test', default=None) add('--test-max-block', type=int, env_var='TEST_MAX_BLOCK', help='(debug) only sync to given block, for running sync test', default=None)
add('--test-skip-ais-phase', env_var='TEST_SKIP_AIS_PHASE', help='(debug) Allows to skip After-Initial-Sync phase. Useful to go into live sync or exit if TEST_MAX_BLOCK is used', action='store_true')
add('--test-profile', type=strtobool, env_var='TEST_PROFILE', help='(debug) profile execution', default=False) add('--test-profile', type=strtobool, env_var='TEST_PROFILE', help='(debug) profile execution', default=False)
add('--log-request-times', env_var='LOG_REQUEST_TIMES', help='(debug) allows to generate log containing request processing times', action='store_true') add('--log-request-times', env_var='LOG_REQUEST_TIMES', help='(debug) allows to generate log containing request processing times', action='store_true')
add('--log-virtual-op-calls', env_var='LOG_VIRTUAL_OP_CALLS', help='(debug) log virtual op calls and responses', default=False) add('--log-virtual-op-calls', env_var='LOG_VIRTUAL_OP_CALLS', help='(debug) log virtual op calls and responses', default=False)
......
...@@ -293,6 +293,8 @@ class Sync: ...@@ -293,6 +293,8 @@ class Sync:
log.info("target_head_block : %s", hived_head_block) log.info("target_head_block : %s", hived_head_block)
skip_after_initial_sync = self._conf.get('test_skip_ais_phase')
if DbState.is_initial_sync(): if DbState.is_initial_sync():
DbState.before_initial_sync(last_imported_block, hived_head_block) DbState.before_initial_sync(last_imported_block, hived_head_block)
# resume initial sync # resume initial sync
...@@ -305,7 +307,10 @@ class Sync: ...@@ -305,7 +307,10 @@ class Sync:
# behavior for the time of post initial actions # behavior for the time of post initial actions
restore_handlers() restore_handlers()
try: try:
DbState.finish_initial_sync(current_imported_block) if skip_after_initial_sync:
log.info("finish initial sync phase skipped due to user request")
else:
DbState.finish_initial_sync(current_imported_block)
except KeyboardInterrupt: except KeyboardInterrupt:
log.info("Break finish initial sync") log.info("Break finish initial sync")
set_exception_thrown() set_exception_thrown()
......
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