def install_client(config): global _memcached global _mysql global _mysql_bak global _config current_dir = os.path.dirname(os.path.realpath(__file__)) app_dir = os.path.dirname(current_dir) if not _config: _config = Config() _config.configure(os.path.join(app_dir, "config", "%s.conf" % (config))) if not _memcached: _memcached = MemcacheClient(_config.memcached) if not _mysql: _mysql = MysqlClient(_config.mysql) if not _mysql_bak: _mysql_bak = MysqlClient(_config.mysql, True)
yield g.put() logging.info("google %s,%s,%s,%s,%s" % (device_id , user_id , password, google_play_id, game_center_id)) if device.game_center_id: g = yield GameCenterBind.get(device.game_center_id) if not g: g = GameCenterBind() g.pkey = device.game_center_id g.user_ids = [device.pkey] logging.info("apple %s,%s,%s,%s,%s" % (device_id , user_id , password, google_play_id, game_center_id)) yield g.put() """ yield gen.sleep(0.01) f.close() shutdown() define("config", default="production", help="service mode [production, staging, ci]", type=str) if __name__ == "__main__": parse_command_line() current_dir = os.path.dirname(os.path.realpath(__file__)) config.configure( os.path.join(current_dir, "config", "%s.conf" % (options.config))) # add signal handler to stop server signal.signal(signal.SIGTERM, sig_handler) signal.signal(signal.SIGINT, sig_handler) ioloop.IOLoop.instance().run_sync(main) ioloop.IOLoop.instance().start()