cache local instance (#572)
* cache local instance fix #564 * don't use local instance cache for plm * use instance cache for plm, but initialize it * cargo fmt
This commit is contained in:
committed by
Baptiste Gelez
parent
5b50f90d2b
commit
773fbfe7c8
@@ -6,7 +6,7 @@ extern crate rpassword;
|
||||
|
||||
use clap::App;
|
||||
use diesel::Connection;
|
||||
use plume_models::{Connection as Conn, CONFIG};
|
||||
use plume_models::{instance::Instance, Connection as Conn, CONFIG};
|
||||
use std::io::{self, prelude::*};
|
||||
|
||||
mod instance;
|
||||
@@ -27,6 +27,7 @@ fn main() {
|
||||
|
||||
dotenv::dotenv().ok();
|
||||
let conn = Conn::establish(CONFIG.database_url.as_str());
|
||||
let _ = conn.as_ref().map(|conn| Instance::cache_local(conn));
|
||||
|
||||
match matches.subcommand() {
|
||||
("instance", Some(args)) => {
|
||||
|
||||
@@ -129,7 +129,7 @@ fn reset_password<'a>(args: &ArgMatches<'a>, conn: &Connection) {
|
||||
let user = User::find_by_name(
|
||||
conn,
|
||||
&username,
|
||||
Instance::get_local(conn)
|
||||
Instance::get_local()
|
||||
.expect("Failed to get local instance")
|
||||
.id,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user