Commit 23e51d59 authored by Christian Pointner's avatar Christian Pointner
Browse files

improved health check for importer

parent 2e46f085
Pipeline #553 passed with stages
in 11 minutes and 13 seconds
......@@ -87,20 +87,18 @@ func (im *Importer) GetJob(show string, id uint64) (*Job, error) {
func (im *Importer) Healthz(ctx context.Context) (err error) {
if len(im.workers) != im.conf.Workers {
return fmt.Errorf("importer has not enough/too many worker: got %d, expected %d", len(im.workers), im.conf.Workers)
numOK := 0
for _, ws := range im.workers {
switch ws.get() {
case WorkerIdle:
case WorkerBusy:
err = fmt.Errorf("at least one worker is not running")
if numOK != im.conf.Workers {
err = fmt.Errorf("only %d out of %d workers are running", numOK, im.conf.Workers)
......@@ -112,6 +110,7 @@ func (im *Importer) deleteJob(show string, id uint64) error {
func (im *Importer) runWorker(idx int, state *WorkerState) {
defer im.dbgLog.Printf("importer: worker(%d) has stopped", idx)
defer state.set(WorkerStopped)
im.dbgLog.Printf("importer: worker(%d) is running", idx)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment