Skip to content

Commit

Permalink
fix an assert that fails when count=nothing
Browse files Browse the repository at this point in the history
Fix #38.
  • Loading branch information
mortenpi committed Oct 24, 2023
1 parent de2445c commit 07df568
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/jobs/logging-kafka.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 07df568

Please sign in to comment.