Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 28 lines (22 sloc) 0.646 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import uwsgi
from uwsgidecorators import *

@signal(17, target='workers')
def hello(signum):
    print("I AM THE WORKER %d" % uwsgi.worker_id())

@signal(30, target='worker2')
def hello2(signum):
    print("I AM THE WORKER 2")

@postfork
def wait_for_signal():
    if uwsgi.worker_id() != 2:
        print("waiting for a signal...")
        uwsgi.signal_wait()
        print("signal %d received" % uwsgi.signal_received())


def application(e, s):
    s('200 OK', [('Content-Type', 'text/html')])
    if e['PATH_INFO'] == '/30':
        uwsgi.signal(30)
        uwsgi.signal(100)
    else:
        uwsgi.signal(17)
    return "Signal raised"
   
Something went wrong with that request. Please try again.