Skip to content

Commit

Permalink
fix: broken request limit calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
RouHim committed Dec 30, 2024
1 parent 31dc1a3 commit 8789a33
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/resource_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,16 @@ impl ResourceStore {
pub fn get_random_resources(&self) -> Vec<String> {
let connection = self.persistent_file_store_pool.get().unwrap();
// Request limit is calculated by: (60/SLIDESHOW_INTERVAL)*REFRESH_INTERVAL * 10% buffer
let request_limit =
(60 / config::get_refresh_interval_value()) * config::get_refresh_interval_value();
let request_limit = (request_limit as f32 * 1.1) as usize;
let request_limit = (60. / config::get_slideshow_interval_value() as f32)
* config::get_refresh_interval_value() as f32;
let request_limit = (request_limit * 1.1) as usize;
// print all variables
println!(
"Request limit: {}, Refresh interval: {}, Slideshow interval: {}",
request_limit,
config::get_refresh_interval_value(),
config::get_slideshow_interval_value()
);
let mut stmt = connection
.prepare(&format!(
r#"
Expand Down

0 comments on commit 8789a33

Please sign in to comment.