1
0
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:
nxshock 2022-10-13 20:29:15 +05:00
parent da1437df54
commit 47e83f3f6e
3 changed files with 6 additions and 6 deletions

View File

@ -33,12 +33,12 @@ func httpPost(addr string, text string) error {
}
resp, err := httpClient.Post(addr, "text/plain", strings.NewReader(text))
defer resp.Body.Close() // TODO: нужно ли закрывать Body при наличии ошибки?
if err != nil {
return err
}
defer resp.Body.Close()
return nil // TODO: вернуть ошибку Post при наличии
return nil
}
func httpGet(addrFmt, jobName, text string) error {

View File

@ -46,10 +46,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
job.NextLaunch = jobEntry.Next.Format(config.TimeFormat)
jobs = append(jobs, job)
}
templates.ExecuteTemplate(buf, "index.htm", jobs)
_ = templates.ExecuteTemplate(buf, "index.htm", jobs)
globalMutex.RUnlock()
buf.WriteTo(w)
_, _ = buf.WriteTo(w)
}
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) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("Application terminated.\n"))
_, _ = w.Write([]byte("Application terminated.\n"))
go func() {
time.Sleep(time.Second)

View File

@ -23,7 +23,7 @@
</td>
<tr>
<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>
<td>Status</td>