This commit is contained in:
parent
cdc3ac4064
commit
dc3405d07a
@ -73,6 +73,7 @@ impl Context {
|
|||||||
GIT_VERSION,
|
GIT_VERSION,
|
||||||
gethostname(false)
|
gethostname(false)
|
||||||
))
|
))
|
||||||
|
.timeout(Duration::seconds(15).to_std().unwrap())
|
||||||
.build()
|
.build()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
sas: HashMap::new(),
|
sas: HashMap::new(),
|
||||||
|
@ -5,8 +5,10 @@ use crate::utils::sleep_s;
|
|||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use reqwest::Error as ReqError;
|
use reqwest::Error as ReqError;
|
||||||
|
|
||||||
|
const MAX_FAILED_API_RATE: u64 = 10;
|
||||||
|
|
||||||
pub async fn send_to_ipbl_api(client: &Client, server: &str, ip: &IpEvent) {
|
pub async fn send_to_ipbl_api(client: &Client, server: &str, ip: &IpEvent) {
|
||||||
let mut i = 1;
|
let mut i = 0;
|
||||||
loop {
|
loop {
|
||||||
match push_ip(&client, &server, &ip.ipdata).await {
|
match push_ip(&client, &server, &ip.ipdata).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
@ -15,7 +17,7 @@ pub async fn send_to_ipbl_api(client: &Client, server: &str, ip: &IpEvent) {
|
|||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("{err}");
|
println!("{err}");
|
||||||
sleep_s(1).await;
|
sleep_s(1).await;
|
||||||
if i == 10 {
|
if i == MAX_FAILED_API_RATE {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user