Skip to content

Commit

Permalink
refactor: reorder stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
null8626 committed Jan 3, 2024
1 parent 3f31aa0 commit d26447e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/autoposter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ impl AutoposterHandle {
/// .await;
/// ```
pub async fn feed(&self, new_stats: Stats) {
{
if self.data.sem.available_permits() < 1 {
let mut lock = self.data.stats.lock().await;
*lock = new_stats;
};

if self.data.sem.available_permits() == 0 {
self.data.sem.add_permits(1);

*lock = new_stats;
}
}
}
Expand Down

0 comments on commit d26447e

Please sign in to comment.