mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 02:34:42 +00:00
Worker listen to random port so we can run multiple worker
This commit is contained in:
parent
4cf3d4c9c5
commit
a461415038
2 changed files with 9 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -63,7 +64,9 @@ func initializeWorker() {
|
|||
}()
|
||||
|
||||
go worker.Run()
|
||||
http.ListenAndServe(":8001", nil)
|
||||
port := rand.Int()%100 + 8000
|
||||
log.Println("Listening at port: localhost:", port)
|
||||
http.ListenAndServe(":"+strconv.Itoa(port), nil)
|
||||
}
|
||||
|
||||
func monitor() {
|
||||
|
|
|
|||
|
|
@ -165,6 +165,11 @@ func (v *VpxEncoder) startLooping() {
|
|||
log.Println("Encoding time: ", time.Now().Sub(beginEncoding))
|
||||
}
|
||||
}
|
||||
if v.Done == true {
|
||||
// The first time we see IsRunning set to false, we release and return
|
||||
v.Release()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Release release memory and stop loop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue