def fetch_tasks(targets): ''' 从 redis 和 es中获取扫描报文 :param targets: :return: ''' total = 0 targets_list = targets.split(',') for host in targets_list: cursor =0 key = 'request_'+host request_count = RedisHelper().hLen(key) logger.info('host:{}|total request:{}|'.format(host, request_count)) while True: rst = RedisHelper().hScan(key, cursor) cursor = rst[0] data_set = rst[1] for request in data_set.values(): new_request, refresh = update_session(request) save_to_immediate_queue(new_request) '''' ''' #---- load request from es--- return total
async def on_connect(self, sid, environ): user = await self.authenticate_user(environ) await self.save_session(sid, user) user_room = self.get_room(user.id) self.enter_room(sid, user_room) logger.info( f"User {user.id} ({user.full_name}) connected. Joined {user_room}")
def main() -> None: logger.info("Initializing tests") check_db() asyncio.run(check_cache()) logger.info("Service finished initializing")
def main() -> None: logger.info("Initializing celeryworker service") check_db() logger.info("Service finished initializing")
async def on_disconnect(self, sid): user = await self.get_session(sid) logger.info(f"User {user.id} ({user.full_name}) disconnected")
def main() -> None: logger.info("Creating initial data") init() logger.info("Initial data created")