Keep server alive during scan

This commit is contained in:
Sakuhl 2018-01-15 17:49:04 +01:00
parent d279bf6603
commit 471d7def84

View File

@ -10,6 +10,8 @@ use diesel::pg::PgConnection;
extern crate wynncraft;
extern crate reqwest;
use std::env;
use std::thread;
@ -44,13 +46,13 @@ fn main() {
thread::sleep_ms(2500);
println!("Getting {:?}", name);
if let Ok(Some(prefix)) = wynncraft::guild(&name).map(|x| x.map(|x| x.prefix)) {
let guild = Guild { prefix, name };
let guild = Guild { prefix: prefix.trim().to_owned(), name };
if let Ok(_) = diesel::insert_into(guilds::table)
.values(&guild)
.on_conflict(guilds::prefix)
.do_nothing()
.execute(&conn) {
let _ = reqwest::get("https://https://wynnapi.herokuapp.com/");
} else {
println!("Fail!");
}