mirror of
https://github.com/nxshock/gron.git
synced 2024-11-27 03:41:00 +05:00
Add details command for SQL jobs and fix some minor warnings
This commit is contained in:
parent
da1437df54
commit
47e83f3f6e
@ -33,12 +33,12 @@ func httpPost(addr string, text string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, err := httpClient.Post(addr, "text/plain", strings.NewReader(text))
|
resp, err := httpClient.Post(addr, "text/plain", strings.NewReader(text))
|
||||||
defer resp.Body.Close() // TODO: нужно ли закрывать Body при наличии ошибки?
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
return nil // TODO: вернуть ошибку Post при наличии
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func httpGet(addrFmt, jobName, text string) error {
|
func httpGet(addrFmt, jobName, text string) error {
|
||||||
|
@ -46,10 +46,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
|||||||
job.NextLaunch = jobEntry.Next.Format(config.TimeFormat)
|
job.NextLaunch = jobEntry.Next.Format(config.TimeFormat)
|
||||||
jobs = append(jobs, job)
|
jobs = append(jobs, job)
|
||||||
}
|
}
|
||||||
templates.ExecuteTemplate(buf, "index.htm", jobs)
|
_ = templates.ExecuteTemplate(buf, "index.htm", jobs)
|
||||||
globalMutex.RUnlock()
|
globalMutex.RUnlock()
|
||||||
|
|
||||||
buf.WriteTo(w)
|
_, _ = buf.WriteTo(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleForceStart(w http.ResponseWriter, r *http.Request) {
|
func handleForceStart(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -81,7 +81,7 @@ func handleForceStart(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func handleShutdown(w http.ResponseWriter, r *http.Request) {
|
func handleShutdown(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte("Application terminated.\n"))
|
_, _ = w.Write([]byte("Application terminated.\n"))
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Command</td>
|
<td>Command</td>
|
||||||
<td><pre>{{.JobConfig.Command}}</pre></td>
|
<td><pre>{{if eq .JobConfig.Type 1}}{{.JobConfig.Command}}{{else if eq .JobConfig.Type 2}}{{.JobConfig.SqlText}}{{end}}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Status</td>
|
<td>Status</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user