-
Notifications
You must be signed in to change notification settings - Fork 148
Apply a high watermark for pending pings to process from disk #3206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6554039
to
b9896ae
Compare
glean-core/src/upload/directory.rs
Outdated
@@ -267,18 +288,20 @@ impl PingDirectoryManager { | |||
/// # Returns | |||
/// | |||
/// A vector of tuples with the file size and payload of each ping file in the directory. |
There was a problem hiding this comment.
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
?
glean-core/src/upload/directory.rs
Outdated
@@ -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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
b9896ae
to
298f3a0
Compare
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.
298f3a0
to
7adc7ed
Compare
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.