Mercurial > gemma
changeset 1010:8f23ec811afb
Fixed and harmonized wording in importer queue a bit.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 23 Oct 2018 10:14:41 +0200 |
parents | 76e9296d6191 |
children | 9d4af4b1c5c8 |
files | pkg/controllers/imports.go pkg/imports/queue.go |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/imports.go Tue Oct 23 08:44:41 2018 +0200 +++ b/pkg/controllers/imports.go Tue Oct 23 10:14:41 2018 +0200 @@ -73,7 +73,7 @@ return } - log.Printf("Added job %d\n", jobID) + log.Printf("info: added import #%d to queue\n", jobID) result := struct { ID int64 `json:"id"`
--- a/pkg/imports/queue.go Tue Oct 23 08:44:41 2018 +0200 +++ b/pkg/imports/queue.go Tue Oct 23 10:14:41 2018 +0200 @@ -241,7 +241,7 @@ // re-enqueue the jobs that are in state running. // They where in progess when the server went down. if err := reEnqueueRunning(); err != nil { - log.Printf("re-enquing failed: %v", err) + log.Printf("re-enqueuing failed: %v", err) } for { @@ -261,22 +261,25 @@ } } - log.Printf("starting import job %d\n", idj.id) + log.Printf("starting import #%d\n", idj.id) jc := jobCreator(idj.kind) if jc == nil { - errorAndFail(idj.id, "No creator for kind '%s' found", idj.kind) + errorAndFail(idj.id, "no creator for kind '%s' found", idj.kind) continue } job, err := jc(idj.kind, idj.data) if err != nil { - errorAndFail(idj.id, "Faild to create job: %v", err) + errorAndFail(idj.id, "failed to create job for import #%d: %v", + idj.id, err) continue } feedback := logFeedback(idj.id) + feedback.Info("import #%d started\n", idj.id) + errDo := survive(func() error { return auth.RunAs(idj.user, context.Background(), func(conn *sql.Conn) error { return job.Do(conn, feedback) }) @@ -298,6 +301,6 @@ if err := updateState(idj.id, state); err != nil { log.Printf("setting state of job %d failed: %v\n", idj.id, err) } - log.Printf("job %d finished: %s\n", idj.id, state) + log.Printf("import #%d finished: %s\n", idj.id, state) } }