Windows Service with Python 3.5 and pyinstaller
- Python 3.5.x
- Visual C++ Build Tools 2015
- PyInstaller 3.2
type Dispatcher struct { | |
// A pool of workers channels that are registered with the dispatcher | |
WorkerPool chan chan Job | |
} | |
func NewDispatcher(maxWorkers int) *Dispatcher { | |
pool := make(chan chan Job, maxWorkers) | |
return &Dispatcher{WorkerPool: pool} | |
} |
func payloadHandler(w http.ResponseWriter, r *http.Request) { | |
if r.Method != "POST" { | |
w.WriteHeader(http.StatusMethodNotAllowed) | |
return | |
} | |
// Read the body into a string for json decoding | |
var content = &PayloadCollection{} | |
err := json.NewDecoder(io.LimitReader(r.Body, MaxLength)).Decode(&content) |
var ( | |
MaxWorker = os.Getenv("MAX_WORKERS") | |
MaxQueue = os.Getenv("MAX_QUEUE") | |
) | |
// Job represents the job to be run | |
type Job struct { | |
Payload Payload | |
} |
Windows Service with Python 3.5 and pyinstaller
# Generate a self-signed Certificate and a Private Key | |
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout pkey.pem -out cert.crt |