Add worker server / move timeout to 100 seconds

This commit is contained in:
Senad Uka
2020-03-18 20:42:43 +01:00
parent 62f2e7c3fd
commit 0882dc4b15
3 changed files with 95 additions and 3 deletions

View File

@@ -8,9 +8,9 @@ import (
"time"
)
var requests chan<- structures.Request
var requests chan structures.Request
func ServeHTTP(queue chan<- structures.Request, end chan<- string) {
func ServeHTTP(queue chan structures.Request, end chan<- string) {
requests = queue
http.HandleFunc("/", httpHandler)
err := http.ListenAndServe("127.0.0.1:1337", nil)
@@ -59,7 +59,7 @@ func httpHandler(w http.ResponseWriter, r *http.Request) {
// todo: put timeout in ENV variable
timeout := make(chan bool, 1)
go func() {
time.Sleep(10 * time.Second)
time.Sleep(100 * time.Second)
timeout <- true
}()