use value from .env for polling time
This commit is contained in:
parent
1c5fb8a0f0
commit
4e3ab96b40
10
src/main.rs
10
src/main.rs
|
@ -1,9 +1,9 @@
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
use std::{path::{self, Path}, thread, time::Duration};
|
use std::{path::Path, thread, time::Duration};
|
||||||
|
|
||||||
use log;
|
use log;
|
||||||
use teloxide_core::{prelude::*, types::{Recipient, UpdateKind}};
|
use teloxide_core::{prelude::*, types::Recipient};
|
||||||
use teloxide::Bot;
|
use teloxide::Bot;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
|
@ -55,12 +55,14 @@ async fn main() {
|
||||||
let chat = bot.get_chat(Recipient::Id(ChatId(CHAT_ID.parse::<i64>().unwrap()))).await.unwrap();
|
let chat = bot.get_chat(Recipient::Id(ChatId(CHAT_ID.parse::<i64>().unwrap()))).await.unwrap();
|
||||||
log::info!("Using chat {}", chat.title().unwrap());
|
log::info!("Using chat {}", chat.title().unwrap());
|
||||||
|
|
||||||
log::info!("Starting polling SCM for updates ({})", POLL_TIME);
|
let time = POLL_TIME.parse::<u64>().unwrap();
|
||||||
|
|
||||||
|
log::info!("Starting polling SCM for updates ({})", time);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let (new_prs, new_data) = api::get_new_prs(prs.clone(), repos.clone()).await;
|
let (new_prs, new_data) = api::get_new_prs(prs.clone(), repos.clone()).await;
|
||||||
log::info!("Found {} new PRs", new_prs.len());
|
log::info!("Found {} new PRs", new_prs.len());
|
||||||
thread::sleep(Duration::from_secs(5));
|
thread::sleep(Duration::from_millis(time));
|
||||||
|
|
||||||
if new_prs.len() != 0 {
|
if new_prs.len() != 0 {
|
||||||
prs = new_data;
|
prs = new_data;
|
||||||
|
|
Loading…
Reference in New Issue