Operator supplies updater schedule in config

This commit is contained in:
Vecna 2024-04-12 12:32:01 -04:00
parent c5a05be6d8
commit 158512f427
2 changed files with 5 additions and 9 deletions

View File

@ -6,6 +6,8 @@
"distributors": {
"Lox": "127.0.0.1:8002"
},
"extra_infos_base_url": "https://collector.torproject.org/recent/bridge-descriptors/extra-infos/",
"port": 8003,
"require_bridge_token": false
"require_bridge_token": false,
"updater_schedule": "* * 22 * * * *"
}

View File

@ -43,6 +43,7 @@ pub struct Config {
extra_infos_base_url: String,
//require_bridge_token: bool,
port: u16,
updater_schedule: String,
}
#[derive(Debug, Deserialize)]
@ -135,13 +136,6 @@ enum Command {
#[tokio::main]
async fn main() {
// TODO: Currently, we're processing extra-infos here, but we want to:
// 2. Periodically (daily):
// a) download new extra-infos
// b) determine whether we think each bridge is blocked or not
// c) report these results to the LA
// 3. Store all our data
let args: Args = Args::parse();
let config: Config = serde_json::from_reader(BufReader::new(
@ -178,7 +172,7 @@ async fn main() {
let updater = spawn(async move {
// Run updater once per day
let mut sched = Scheduler::utc();
sched.add(Job::new("* * 22 * * * *", move || {
sched.add(Job::new(config.updater_schedule, move || {
run_updater(updater_tx.clone())
}));
});