diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-11-05 13:54:38 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-11-05 13:54:38 +0100 |
| commit | 52cdd81d77d4922945ec4598f6799671d92b0823 (patch) | |
| tree | b089ca5385c5043e7d0366411154d3b6824fdbe7 | |
| parent | 777d4916b8ce9e80372f4812067c341e7acd78a2 (diff) | |
| download | mullvadvpn-52cdd81d77d4922945ec4598f6799671d92b0823.tar.xz mullvadvpn-52cdd81d77d4922945ec4598f6799671d92b0823.zip | |
Update relay list every hour. Remove mtime check
| -rw-r--r-- | mullvad-daemon/src/relays.rs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs index dab1b50407..de01883e58 100644 --- a/mullvad-daemon/src/relays.rs +++ b/mullvad-daemon/src/relays.rs @@ -28,7 +28,6 @@ const DATE_TIME_FORMAT_STR: &str = "[%Y-%m-%d %H:%M:%S%.3f]"; const RELAYS_FILENAME: &str = "relays.json"; const DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(15); const UPDATE_INTERVAL: Duration = Duration::from_secs(60 * 60); -const MAX_CACHE_AGE: Duration = Duration::from_secs(60 * 60 * 2); error_chain! { errors { @@ -426,14 +425,12 @@ impl RelayListUpdater { debug!("Starting relay list updater thread"); while self.wait_for_next_iteration() { trace!("Relay list updater iteration"); - if self.should_update() { - match self - .update() - .chain_err(|| "Failed to update list of relays") - { - Ok(()) => info!("Updated list of relays"), - Err(error) => error!("{}", error.display_chain()), - } + match self + .update() + .chain_err(|| "Failed to update list of relays") + { + Ok(()) => info!("Updated list of relays"), + Err(error) => error!("{}", error.display_chain()), } } debug!("Relay list updater thread has finished"); @@ -449,13 +446,6 @@ impl RelayListUpdater { } } - fn should_update(&mut self) -> bool { - match SystemTime::now().duration_since(self.lock_parsed_relays().last_updated()) { - Ok(duration) => duration > MAX_CACHE_AGE, - Err(_) => false, - } - } - fn update(&mut self) -> Result<()> { let new_relay_list = self .download_relay_list() |
