Skip to content

Commit

Permalink
Cleaned up logging for importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Nemere committed Dec 4, 2023
1 parent 0533b06 commit 12de08e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/job/jobWatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func AddJob(jobTimeoutSec uint32, db *mongo.Database, idgen idgen.IDGenerator, t
JobId: jobId,
Status: protos.JobStatus_STARTING,
StartUnixTimeSec: now,
OtherLogFiles: []string{},
}

ctx := context.TODO()
Expand Down Expand Up @@ -148,6 +149,7 @@ func watchJob(jobId string, nowUnixSec uint32, watchUntilUnixSec uint32, db *mon

for c := uint32(0); c < maxUpdates; c++ {
time.Sleep(time.Duration(jobUpdateIntervalSec) * time.Second)
logger.Infof(">> Checking watched job: %v...", jobId)

filter := bson.D{{"_id", jobId}}
opt := options.FindOne()
Expand All @@ -162,6 +164,8 @@ func watchJob(jobId string, nowUnixSec uint32, watchUntilUnixSec uint32, db *mon
if err != nil {
logger.Errorf("Failed to decode DB entry for job status: %v", jobId)
} else if lastUpdateUnixSec != dbStatus.LastUpdateUnixTimeSec {
logger.Infof(">> Update sent for watched job: %v...", jobId)

// OK we have a status update! Send
sendUpdate(&dbStatus)

Expand Down

0 comments on commit 12de08e

Please sign in to comment.