Skip to content

Conversation

badboy
Copy link
Member

@badboy badboy commented Jul 30, 2025

If we detect more files in the pending pings directory they are removed without processing. Usually we read all files into memory to sort them and then discard the oldest ones if necessary. However if a user has too many files that's very costly (in both processing time and memory usage), so we add a high watermark. This means there's now a case where we can drop arbitrary data. However if a user has that many pending pings some things might have gone awry and the data is less important than keeping the user's application running smoothly.

@badboy badboy force-pushed the push-uypxwvqntuol branch from 6554039 to b9896ae Compare July 30, 2025 12:43
@@ -267,18 +288,20 @@ impl PingDirectoryManager {
/// # Returns
///
/// A vector of tuples with the file size and payload of each ping file in the directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind updating the doc-comment for the return type to show it now also returns the discarded_files?

@@ -357,7 +392,7 @@ mod test {
let directory_manager = PingDirectoryManager::new(dir.path());

// Verify that processing the directory didn't panic
let data = directory_manager.process_dirs();
let data = directory_manager.process_dirs().1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I hate how un-descriptive index based access is (.1). Not saying we need to change it but it requires me to go and look up the process_dirs() to understand what .1 vs. .0 means here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me too. I don't like how we need to thread through the value here now. If we do want this then I might re-do that part.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for adding this as a guardrail to keep /pending-pings in check, for what it's worth.

@badboy badboy force-pushed the push-uypxwvqntuol branch from b9896ae to 298f3a0 Compare August 1, 2025 10:31
badboy added 3 commits August 1, 2025 12:35
If we detect more files in the pending pings directory they are removed without processing.
Usually we read all files into memory to sort them and then discard the oldest ones if necessary.
However if a user has too many files that's very costly (in both processing time and memory usage), so we add a high watermark.
This means there's now a case where we can drop arbitrary data.
However if a user has _that many pending pings_ some things might have gone awry and the data is less important than keeping the user's application running smoothly.
@badboy badboy force-pushed the push-uypxwvqntuol branch from 298f3a0 to 7adc7ed Compare August 1, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants