Open jamesbt365 opened 2 months ago
I'll take this up.
I believe that this is the only method to change max_messages
at runtime after creation:
/// Sets the maximum amount of messages per channel to cache.
///
/// By default, no messages will be cached.
pub fn set_max_messages(&self, max: usize) {
self.settings.write().max_messages = max;
}
I'll make it check if the argument max
is less than max_messages
by reading the settings since checking it after assigning the new value should take more time. And if it is greater, delete the messages from Cache.messages
that correspond to the front of Cache.message_queue
for each channel's queue. Does that sound good?
I'm not sure if we had this at some point but we certainly don't now, if max messages is reduced at runtime any amount set over the limit is kept.