async def _run(self):
tick_gen = _task_idle_ticks(<NUM_LIT:0.5>*self._shard_ttl)<EOL>self._is_running = True<EOL>self._ready_event.clear()<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>await self._lease_shard()<EOL>break<EOL><DEDENT>except grpc.RpcError as exc:<EOL><INDENT>nap = _rand_uniform(<NUM_LIT:3>, <NUM_LIT:15>)<EOL>logger.warn(f'<STR_LIT>'<EOL>f'<STR_LIT>')<EOL>if await self._continueAfterSleep(nap):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>return<EOL><DEDENT><DEDENT><DEDENT>assert self._shard_id is not None           <EOL>try:<EOL><INDENT>while self._is_running:<EOL><INDENT>self._ready_event.clear()<EOL>try:<EOL><INDENT>await self._renew_timestamp()<EOL>await self._keepalive_shard()<EOL><DEDENT>except grpc.RpcError as exc: <EOL><INDENT>nap = _rand_uniform(<NUM_LIT:3>, <NUM_LIT:15>)<EOL>logger.warn(f'<STR_LIT>'<EOL>f'<STR_LIT>')<EOL>if await self._continueAfterSleep(nap):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>self._ready_event.set()<EOL>if await self._continueAfterSleep(next(tick_gen)):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>except asyncio.CancelledError:<EOL><INDENT>pass<EOL><DEDENT>except Exception:<EOL><INDENT>logger.error(f'<STR_LIT>', exc_info=True)<EOL><DEDENT>finally:<EOL><INDENT>self._ready_event.clear()<EOL>await self._lease.revoke() <EOL>logger.debug(f'<STR_LIT>')<EOL><DEDENT>
后台任务更新时间戳和重置序号