Skip to content

Commit

Permalink
More robust buildscript, fix #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Dec 11, 2024
1 parent 4c67f99 commit 5f10063
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "db_ip"
authors = ["Finn Bear"]
version = "0.3.9"
version = "0.3.10"
edition = "2018"
license = "MIT OR Apache-2.0"
repository = "https://github.com/finnbear/db_ip/"
Expand Down
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() -> Result<(), &'static str> {
use std::ops::Sub;
use std::time::SystemTime;

for i in 0..12 {
for i in 0..48 {
let date = Utc::now().date().sub(
Duration::from_std(std::time::Duration::from_secs(i * 31 * 24 * 3600)).unwrap(),
);
Expand Down Expand Up @@ -69,6 +69,9 @@ fn main() -> Result<(), &'static str> {
.unwrap_or(true)
{
let mut resp = reqwest::blocking::get(url).map_err(|_| "request failed")?;
if !resp.status().is_success() {
return Err("failed to download");
}
let mut out = File::create(path).map_err(|_| "failed to create file")?;
let mut decoded = GzDecoder::new(BufReader::new(&mut resp));
io::copy(&mut decoded, &mut out)
Expand Down

0 comments on commit 5f10063

Please sign in to comment.