Skip to content

Commit

Permalink
Speed up summary reporter when skipping up-to-date targets
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jan 9, 2025
1 parent 62a1248 commit 9c46871
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 7 additions & 5 deletions R/class_reporter.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ reporter_class <- R6::R6Class(
public = list(
seconds_interval = NULL,
buffer = NULL,
seconds_flushed = NULL,
seconds_flushed = -Inf,
seconds_skipped = -Inf,
initialize = function(seconds_interval = NULL) {
self$seconds_interval <- seconds_interval
},
poll = function() {
self$seconds_flushed <- self$seconds_flushed %|||% -Inf
now <- time_seconds_local()
if ((now - self$seconds_flushed) > self$seconds_interval) {
self$flush_messages()
self$seconds_flushed <- time_seconds_local()
if ((now - seconds_flushed) > seconds_interval) {
flush_messages()
self$seconds_flushed <- now
}
},
report_start = function() {
Expand Down Expand Up @@ -75,3 +75,5 @@ reporter_class <- R6::R6Class(
}
)
)

reporter_seconds_skipped <- 0.25
6 changes: 5 additions & 1 deletion R/class_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ summary_class <- R6::R6Class(
self$report_progress(progress)
},
report_skipped = function(target = NULL, progress) {
self$report_progress(progress)
now <- time_seconds_local()
if ((now - seconds_skipped) > reporter_seconds_skipped) {
report_progress(progress)
self$seconds_skipped <- now
}
},
report_errored = function(target = NULL, progress) {
self$report_progress(progress)
Expand Down

0 comments on commit 9c46871

Please sign in to comment.