removed unwrap from limit function

This commit is contained in:
epi
2022-05-05 19:18:29 -05:00
parent ccb10c1c68
commit c8a577b1e7
2 changed files with 7 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ jobs:
env:
IN_PIPELINE: true
runs-on: ${{ matrix.os }}
if: github.ref == 'refs/heads/main'
# if: github.ref == 'refs/heads/main'
strategy:
matrix:
type: [ubuntu-x64, ubuntu-x86, armv7, aarch64]

View File

@@ -124,13 +124,12 @@ impl Requester {
/// limit the number of requests per second
pub async fn limit(&self) -> Result<()> {
self.rate_limiter
.read()
.await
.as_ref()
.unwrap()
.acquire_one()
.await?;
let guard = self.rate_limiter.read().await;
if guard.is_some() {
guard.as_ref().unwrap().acquire_one().await?;
}
Ok(())
}