Skip to content

Commit

Permalink
Fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Jan 28, 2025
1 parent dc1d206 commit bb2a78c
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/domain/notification_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl NotificationFactory {
// depth=3 (internal parameter controlling accuracy)
// decay=0.5 (decay factor between 0 and 1 for aging out less frequent items;
// lower values cause faster forgetting of infrequent items)
let top_followees = TopK::new(100, 500, 3, 0.5);
let top_followees: TopK<Vec<u8>> = TopK::new(100, 500, 3, 0.5);

// Initialize metrics with 0 values
for node in top_followees.list() {
Expand Down Expand Up @@ -141,17 +141,9 @@ impl NotificationFactory {
);

info!("Top 100 most followed accounts:");
// Set all current values to 0 first to handle decreases
for node in self.top_followees.list() {
if let Ok(friendly_id) = String::from_utf8(node.item.to_vec()) {
metrics::top_followee_count(friendly_id.clone()).set(0.0);
}
}
// Then set the actual values
for node in self.top_followees.list() {
if let Ok(friendly_id) = String::from_utf8(node.item.to_vec()) {
metrics::top_followee_count(friendly_id.clone()).set(node.count as f64);
info!(" {}: {} follows", friendly_id, node.count);
}
}
}
Expand Down

0 comments on commit bb2a78c

Please sign in to comment.