mirror of
https://github.com/nxshock/gron.git
synced 2024-11-27 03:41:00 +05:00
Log host which sends job requests
This commit is contained in:
parent
dac381b93a
commit
6708aeb531
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
@ -53,7 +54,11 @@ func handleForceStart(w http.ResponseWriter, r *http.Request) {
|
||||
for _, jobEntry := range jobEntries {
|
||||
job := jobEntry.Job.(*Job)
|
||||
if job.FileName == jobName {
|
||||
log.WithField("job", "http_server").Printf("forced start %s", job.FileName)
|
||||
host, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
host = r.RemoteAddr
|
||||
}
|
||||
log.WithField("job", "http_server").Printf("forced start %s from %s", job.FileName, host)
|
||||
go job.Run()
|
||||
time.Sleep(time.Second / 4) // wait some time for job start
|
||||
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
|
||||
|
Loading…
Reference in New Issue
Block a user