Пример #1
0
 def get_stats(self,
               host: str,
               port: int,
               bucket: str,
               stats: str = '') -> dict:
     retries = 0
     while True:
         try:
             mc = MemcachedClient(host=host, port=port, family=self.family)
             mc.enable_xerror()
             mc.hello("mc")
             mc.sasl_auth_plain(user=bucket, password=self.password)
             return mc.stats(stats)
         except Exception:
             if retries < MAX_RETRY:
                 retries += 1
                 time.sleep(SOCKET_RETRY_INTERVAL)
             else:
                 raise