Skip to content

Instantly share code, notes, and snippets.

@philipcristiano
Last active December 18, 2015 22:28
Show Gist options
  • Save philipcristiano/5854424 to your computer and use it in GitHub Desktop.
Save philipcristiano/5854424 to your computer and use it in GitHub Desktop.
gunicorn worker hook
import socket
import time
def post_worker_init(worker):
_send_udp('200 OK\n')
def _send_udp(message):
udp_ip = "127.0.0.1"
udp_port = 4012
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(message, (udp_ip, udp_port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment