def health(): cur = postgres.init() health = postgres.healthcheck(cur) if health == 1: return "ok", 200 else: return "not ok", 500
def refresh(): restaurants = resto.load_restaurants() limit = int(getenv("LIMIT")) if getenv("LIMIT") else None restaurants_menu = resto.get_unavailable_menu(restaurants[:limit]) cur = postgres.init() status = postgres.save_restaurants(cur, restaurants_menu) return status
def before_run(self, io_loop): LOG.info('starting default server ...') {%- if cookiecutter.use_database == 'y' %} postgres_settings = dict( max_pool_size=tornado_options.postgres_max_pool_size, reconnect_interval=tornado_options.postgres_reconnect_interval ) f = postgres.init(tornado_options.postgres_uri, io_loop=io_loop, **postgres_settings) io_loop.add_future(f, lambda x: x) {%- endif %}
def get_missing_flurries(): cur = postgres.init() missingflurry = postgres.get_restaurants(cur) return Response(missingflurry, mimetype='application/javascript')