Skip to content

Commit

Permalink
try limit 10 for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
MickStanciu committed Jul 18, 2024
1 parent 860675c commit f4a7dc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions pkg/internal/feed/exporter_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ func (e *CSVExporter) FinaliseExport(feed Feed, rows interface{}) error {
logger := e.Logger.With("feed", feed.Name())
logger.Info("writing out CSV file")
status := GetExporterStatus()
status.UpdateStage(feed.Name(), StageCsv)
status.UpdateStage(feed.Name(), StageCsv, false)

err := e.cleanOldFiles(feed.Name())
if err != nil {
return err
}

limit := 10000
// TODO remove me
limit := 10
if limit > e.MaxRowsPerFile {
limit = e.MaxRowsPerFile
}
Expand Down Expand Up @@ -113,10 +114,10 @@ func (e *CSVExporter) FinaliseExport(feed Feed, rows interface{}) error {
offset = offset + limit
rowsAdded += int(resp.RowsAffected)

status.UpdateStatus(feed.Name(), resp.RowsAffected, postWriteTime.Sub(preTime).Milliseconds())
status.UpdateStatus(feed.Name(), int64(rowsAdded), postWriteTime.Sub(preTime).Milliseconds())

logger.With(
"rows_added", resp.RowsAffected,
"rows_added", rowsAdded,
"total_time_ms", postWriteTime.Sub(preTime).Milliseconds(),
"query_time_ms", postQueryTime.Sub(preTime).Milliseconds(),
"write_time_ms", postWriteTime.Sub(postQueryTime).Milliseconds(),
Expand Down
3 changes: 2 additions & 1 deletion pkg/internal/feed/feed_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ func (e *ExportStatus) IncrementStatus(feedName string, counter int64, durationM
e.lock.Unlock()
}

func (e *ExportStatus) UpdateStage(feedName string, stage ExportStatusItemStage) {
func (e *ExportStatus) UpdateStage(feedName string, stage ExportStatusItemStage, counterDecremental bool) {
e.lock.Lock()
if _, ok := e.status[feedName]; ok {
e.status[feedName].Stage = stage
e.status[feedName].CounterDecremental = counterDecremental
}
e.lock.Unlock()
}
Expand Down

0 comments on commit f4a7dc7

Please sign in to comment.