Skip to content

Commit

Permalink
Don't cache files for availableNow trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimahriman committed May 15, 2024
1 parent d0385c4 commit c907d94
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ class FileStreamSource(

// Obey user's setting to limit the number of files in this batch trigger.
val (batchFiles, unselectedFiles) = limit match {
case files: ReadMaxFiles if !sourceOptions.latestFirst =>
case files: ReadMaxFiles
if !sourceOptions.latestFirst && allFilesForTriggerAvailableNow == null =>
// we can cache and reuse remaining fetched list of files in further batches
val (bFiles, usFiles) = newFiles.splitAt(files.maxFiles())
if (usFiles.size < files.maxFiles() * DISCARD_UNSEEN_INPUT_RATIO) {
Expand All @@ -198,7 +199,8 @@ class FileStreamSource(
// implies "sourceOptions.latestFirst = true" which we want to refresh the list per batch
(newFiles.take(files.maxFiles()), null)

case files: ReadMaxBytes if !sourceOptions.latestFirst =>
case files: ReadMaxBytes
if !sourceOptions.latestFirst && allFilesForTriggerAvailableNow == null =>
// we can cache and reuse remaining fetched list of files in further batches
val (FilesSplit(bFiles, _), FilesSplit(usFiles, rSize)) =
takeFilesUntilMax(newFiles, files.maxBytes())
Expand Down

0 comments on commit c907d94

Please sign in to comment.