refactor: 🔨 linting
This commit is contained in:
parent
4ee49e571a
commit
5d80f46e6e
58
.vscode/settings.json
vendored
58
.vscode/settings.json
vendored
@ -1,38 +1,38 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
// // 🧩 modules
|
||||
// "migration": true,
|
||||
// // "entities": true,
|
||||
// 🧩 modules
|
||||
"migration": true,
|
||||
// "entities": true,
|
||||
|
||||
// // ⚙️
|
||||
// ".env": true,
|
||||
// "Taskfile.yaml": true,
|
||||
// ".cocorc": true,
|
||||
// ".task": true,
|
||||
// ".cargo": true,
|
||||
// ".github": true,
|
||||
// "rustfmt.toml": true,
|
||||
// // "**/**/Cargo.toml": true,
|
||||
// ⚙️
|
||||
".env": true,
|
||||
"Taskfile.yaml": true,
|
||||
".cocorc": true,
|
||||
".task": true,
|
||||
".cargo": true,
|
||||
".github": true,
|
||||
"rustfmt.toml": true,
|
||||
// "**/**/Cargo.toml": true,
|
||||
|
||||
// // 📦
|
||||
// "Cargo.lock": true,
|
||||
// "target": true,
|
||||
// 📦
|
||||
"Cargo.lock": true,
|
||||
"target": true,
|
||||
|
||||
// // 📝 readmes
|
||||
// "**/**/README.md": true,
|
||||
// "LICENSE": true,
|
||||
// 📝 readmes
|
||||
"**/**/README.md": true,
|
||||
"LICENSE": true,
|
||||
|
||||
// // 🗑️
|
||||
// "check_size.py": true,
|
||||
// "*.code-workspace": true,
|
||||
// // ".gitignore": true,
|
||||
// ".vscode": true,
|
||||
// ".git": true,
|
||||
// 🗑️
|
||||
"check_size.py": true,
|
||||
"*.code-workspace": true,
|
||||
// ".gitignore": true,
|
||||
".vscode": true,
|
||||
".git": true,
|
||||
|
||||
// // 🗄️ database
|
||||
// "rustler.db": true,
|
||||
// "rustler.db-shm": true,
|
||||
// "rustler.db-wal": true,
|
||||
// "rustler.db.bkp": true,
|
||||
// 🗄️ database
|
||||
"rustler.db": true,
|
||||
"rustler.db-shm": true,
|
||||
"rustler.db-wal": true,
|
||||
"rustler.db.bkp": true,
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,11 @@ tasks:
|
||||
- python check_size.py
|
||||
|
||||
fmt:
|
||||
desc: 🚀 format rustler
|
||||
desc: 🎨 format rustler
|
||||
cmds:
|
||||
- cargo +nightly fmt --all
|
||||
- cargo +nightly fmt --all
|
||||
|
||||
lint:
|
||||
desc: 🧶 lint rustler
|
||||
cmds:
|
||||
- cargo clippy --fix --workspace --allow-dirty
|
||||
@ -2,7 +2,7 @@ use {
|
||||
dotenvy::dotenv,
|
||||
entities::sea_orm::{ConnectionTrait, Database, DbBackend, Statement},
|
||||
eyre::Result,
|
||||
std::sync::{Arc, Mutex},
|
||||
std::sync::Arc,
|
||||
};
|
||||
|
||||
// TODO: here we will trigger the start of both the grpc server and the websocket gateway
|
||||
|
||||
@ -2,10 +2,7 @@ use {
|
||||
super::{Entity as MarketEntity, Model as MarketModel},
|
||||
eyre::Result,
|
||||
sea_orm::{DatabaseConnection, EntityTrait, IntoActiveModel},
|
||||
std::{
|
||||
sync::{Arc, Mutex},
|
||||
time::Instant,
|
||||
},
|
||||
std::{sync::Arc, time::Instant},
|
||||
};
|
||||
|
||||
pub struct Service {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
use {
|
||||
core::time,
|
||||
entities::{market, sea_orm::DatabaseConnection},
|
||||
eyre::Result,
|
||||
std::{env, sync::Arc, thread, time::Instant},
|
||||
std::{sync::Arc, time::Instant},
|
||||
tonic::{transport::Server, Request, Response, Status},
|
||||
};
|
||||
|
||||
@ -57,10 +56,10 @@ pub struct GrpcServer {
|
||||
impl MarketApi for GrpcServer {
|
||||
async fn get_all(&self, _: Request<Empty>) -> Result<Response<Markets>, Status> {
|
||||
let start = Instant::now();
|
||||
if let Some(mkts) = self.svc.get_all().await.ok() {
|
||||
if let Ok(mkts) = self.svc.get_all().await {
|
||||
println!("get_all took {:?}", start.elapsed());
|
||||
Ok(Response::new(Markets {
|
||||
markets: mkts.into_iter().map(|m| Market::from_model(m)).collect(),
|
||||
markets: mkts.into_iter().map(Market::from_model).collect(),
|
||||
}))
|
||||
} else {
|
||||
println!("get_all took {:?}", start.elapsed());
|
||||
@ -72,7 +71,7 @@ impl MarketApi for GrpcServer {
|
||||
let start = Instant::now();
|
||||
let mkt = market.into_inner().into_model();
|
||||
|
||||
if let Some(m) = self.svc.create(mkt).await.ok() {
|
||||
if let Ok(m) = self.svc.create(mkt).await {
|
||||
println!("create took {:?}", start.elapsed());
|
||||
Ok(Response::new(Market::from_model(m)))
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user