Remove some cruft and use exitcode to determine failure state

This commit is contained in:
Justin Hawkins 2021-09-21 17:46:18 +09:30
parent 1a5a7ae90c
commit eadcb5a067

13
main.go
View File

@ -61,13 +61,6 @@ func main() {
ReadTimeout: 0 * time.Second, ReadTimeout: 0 * time.Second,
} }
go func() {
for {
//fmt.Printf("\n\n%#V\n\n", downloads)
time.Sleep(time.Second)
}
}()
log.Fatal(srv.ListenAndServe()) log.Fatal(srv.ListenAndServe())
} }
@ -92,7 +85,6 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
BookmarkletURL: template.URL(bookmarkletURL), BookmarkletURL: template.URL(bookmarkletURL),
} }
log.Printf("%s", info.BookmarkletURL)
err = t.ExecuteTemplate(w, "layout", info) err = t.ExecuteTemplate(w, "layout", info)
if err != nil { if err != nil {
panic(err) panic(err)
@ -219,7 +211,10 @@ func queue(dl *download) {
dl.Finished = true dl.Finished = true
dl.ExitCode = cmd.ProcessState.ExitCode() dl.ExitCode = cmd.ProcessState.ExitCode()
fmt.Printf("OBJ %#v\n", dl) if dl.ExitCode != 0 {
dl.State = "failed"
}
} }
func updateDownload(r io.Reader, dl *download) { func updateDownload(r io.Reader, dl *download) {