From 07df568f48a9f9aecc0742e499665f187ae8039b Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Tue, 24 Oct 2023 15:16:02 +0900 Subject: [PATCH] fix an assert that fails when count=nothing Fix #38. --- src/jobs/logging-kafka.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/jobs/logging-kafka.jl b/src/jobs/logging-kafka.jl index 06e5169e1..5261f5843 100644 --- a/src/jobs/logging-kafka.jl +++ b/src/jobs/logging-kafka.jl @@ -144,10 +144,13 @@ function _job_logs_newer!( timeout=_KAFKA_DEFAULT_GET_TIMEOUT ) job_is_done && (b._found_last = true) - # If the returned list of logs is empty, we check if we can still update the cursor - # maybe before returning. + # If the returned list of logs is empty, we check if we can still maybe update the + # cursor before returning. If `count` is set, then we should only reach this point + # when the `count` value is bigger than the number of logs available in the buffer. + # Hence we can safely declare the active range to go all the way to the end of the + # buffer. if isempty(logs) && (b._active_range.stop < length(b._logs)) - @assert b._active_range.stop + count > length(b._logs) + @assert isnothing(count) || (b._active_range.stop + count > length(b._logs)) b._active_range = (b._active_range.start):length(b._logs) _job_logs_kafka_notify_cb(b) return nothing