Ejemplo n.º 1
0
def start_server():
    evwsgi.start("0.0.0.0", "5747")
    evwsgi.set_base_module(fapws.base)
    stats_app = AnyStat()
    evwsgi.wsgi_cb(("/stats/", stats_app))
    def commit(env):
        stats_app.cache.commit()
        return uwsgi.SPOOL_RETRY
    uwsgi.set_spooler_frequency(30)
    uwsgi.spooler = commit
    uwsgi.send_to_spooler({'action':'start'})
Ejemplo n.º 2
0
def start_server():
    evwsgi.start("0.0.0.0", "5747")
    evwsgi.set_base_module(fapws.base)
    stats_app = AnyStat()
    evwsgi.wsgi_cb(("/stats/", stats_app))

    def commit(env):
        stats_app.cache.commit()
        return uwsgi.SPOOL_RETRY

    uwsgi.set_spooler_frequency(30)
    uwsgi.spooler = commit
    uwsgi.send_to_spooler({'action': 'start'})
Ejemplo n.º 3
0
    g = gevent.spawn(get_counter)
    g.join()
    counter = g.value or api.last_count
    counter = "{:,}".format(counter)

    # increment the application wide counter
    gevent.spawn(increment_counter)

    return """<h1>%sé</h1>
<script>
function refresh() {
    window.location.reload(true);
    setTimeout(refresh, 10000);
</script>
""" % str(counter)


# Spooling interval
uwsgi.set_spooler_frequency(15)


@spoolraw
def spooler(env):
    try:
        increment_counter()
    except Exception as e:
        print str(e)
        return uwsgi.SPOOL_RETRY
    else:
        return uwsgi.SPOOL_OK
Ejemplo n.º 4
0
def rrdtool_updater(env):
	uwsgi.set_spooler_frequency(s_freq)
	rrdtool.update('../test.rrd', str(int(time.time()))+':'+str(uwsgi.total_requests()))
	uwsgi.send_to_spooler({})