Skip to content

Commit

Permalink
INTG-3044 feed issues will send the correct status in the logs (#444)
Browse files Browse the repository at this point in the history
* INTG-3044 feed issues will send the correct status in the logs

* INTG-3044 feed issues will send the correct status in the logs
  • Loading branch information
MickStanciu authored Oct 10, 2023
1 parent 3b7a19a commit 26cbdad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/internal/feed/feed_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (f *IssueFeed) Export(ctx context.Context, apiClient *httpapi.Client, expor
status.IncrementStatus(f.Name(), int64(numRows), apiClient.Duration.Milliseconds())

l.With(
"estimated_remaining", resp.Metadata.RemainingRecords,
"downloaded", status.ReadCounter(f.Name()),
"duration_ms", apiClient.Duration.Milliseconds(),
"export_duration_ms", exporter.GetDuration().Milliseconds(),
).Info("export batch complete")
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/feed/feed_issue_timeline_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (f *IssueTimelineItemFeed) Export(ctx context.Context, apiClient *httpapi.C
status.IncrementStatus(f.Name(), int64(numRows), apiClient.Duration.Milliseconds())

l.With(
"estimated_remaining", resp.Metadata.RemainingRecords,
"downloaded", status.ReadCounter(f.Name()),
"duration_ms", apiClient.Duration.Milliseconds(),
"export_duration_ms", exporter.GetDuration().Milliseconds(),
).Info("export batch complete")
Expand Down
9 changes: 9 additions & 0 deletions pkg/internal/feed/feed_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ func (e *ExportStatus) ReadStatus() map[string]*ExportStatusItem {
return e.status
}

func (e *ExportStatus) ReadCounter(feedName string) int64 {
e.lock.Lock()
defer e.lock.Unlock()
if _, ok := e.status[feedName]; ok {
return e.status[feedName].Counter
}
return 0
}

func (e *ExportStatus) PurgeFinished() {
e.lock.Lock()
pendingFeeds := map[string]*ExportStatusItem{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/feed/feed_training_course_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (f *TrainingCourseProgressFeed) Export(ctx context.Context, apiClient *http
status.IncrementStatus(f.Name(), int64(numRows), apiClient.Duration.Milliseconds())

l.With(
"downloaded", numRows,
"downloaded", status.ReadCounter(f.Name()),
"duration_ms", apiClient.Duration.Milliseconds(),
"export_duration_ms", exporter.GetDuration().Milliseconds(),
).Info("export batch complete")
Expand Down

0 comments on commit 26cbdad

Please sign in to comment.