def handle_signal(signum, frame): log.info('Received signal %d, exiting', signum) if uwsgi and 'mule_id' in dir(uwsgi) and uwsgi.mule_id() > 0: farms = os.environ.get(UWSGI_FARMS_VAR, None) if farms: for farm in farms.split(','): uwsgi.farm_msg(farm, SHUTDOWN_MSG) else: uwsgi.mule_msg(SHUTDOWN_MSG, uwsgi.mule_id()) exit.set()
def send_message(self, msg, dest): log.debug('Sending message to farm %s: %s', dest, msg) uwsgi.farm_msg(dest, msg)