Operator supplies updater schedule in config
This commit is contained in:
parent
c5a05be6d8
commit
158512f427
|
@ -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 * * * *"
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
}));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue