chore: fix issues mentioned in nathan review

This commit is contained in:
Bartosz Sypytkowski 2024-10-23 12:13:26 +02:00
parent 53b7f4c15a
commit 82f348271f
4 changed files with 82 additions and 81 deletions

View File

@ -9,9 +9,9 @@ edition = "2021"
actix.workspace = true actix.workspace = true
actix-web.workspace = true actix-web.workspace = true
actix-http = { workspace = true, default-features = false, features = [ actix-http = { workspace = true, default-features = false, features = [
"openssl", "openssl",
"compress-brotli", "compress-brotli",
"compress-gzip", "compress-gzip",
] } ] }
actix-rt = "2.9.0" actix-rt = "2.9.0"
actix-web-actors = { version = "4.3" } actix-web-actors = { version = "4.3" }
@ -28,20 +28,20 @@ serde_repr.workspace = true
serde.workspace = true serde.workspace = true
tokio = { workspace = true, features = [ tokio = { workspace = true, features = [
"macros", "macros",
"rt-multi-thread", "rt-multi-thread",
"sync", "sync",
"fs", "fs",
"time", "time",
"full", "full",
] } ] }
tokio-stream.workspace = true tokio-stream.workspace = true
tokio-util = { version = "0.7.10", features = ["io"] } tokio-util = { version = "0.7.10", features = ["io"] }
futures-util = { workspace = true, features = ["std", "io"] } futures-util = { workspace = true, features = ["std", "io"] }
once_cell = "1.19.0" once_cell = "1.19.0"
chrono = { version = "0.4.37", features = [ chrono = { version = "0.4.37", features = [
"serde", "serde",
"clock", "clock",
], default-features = false } ], default-features = false }
derive_more = { version = "0.99" } derive_more = { version = "0.99" }
secrecy.workspace = true secrecy.workspace = true
@ -49,10 +49,10 @@ rand = { version = "0.8", features = ["std_rng"] }
anyhow = "1.0.79" anyhow = "1.0.79"
thiserror = "1.0.56" thiserror = "1.0.56"
reqwest = { workspace = true, features = [ reqwest = { workspace = true, features = [
"json", "json",
"rustls-tls", "rustls-tls",
"cookies", "cookies",
"stream", "stream",
] } ] }
unicode-segmentation = "1.10" unicode-segmentation = "1.10"
lazy_static.workspace = true lazy_static.workspace = true
@ -62,31 +62,31 @@ bytes = "1.5.0"
rcgen = { version = "0.10.0", features = ["pem", "x509-parser"] } rcgen = { version = "0.10.0", features = ["pem", "x509-parser"] }
mime = "0.3.17" mime = "0.3.17"
aws-sdk-s3 = { version = "1.36.0", features = [ aws-sdk-s3 = { version = "1.36.0", features = [
"behavior-version-latest", "behavior-version-latest",
"rt-tokio", "rt-tokio",
] } ] }
aws-config = { version = "1.5.1", features = ["behavior-version-latest"] } aws-config = { version = "1.5.1", features = ["behavior-version-latest"] }
redis = { workspace = true, features = [ redis = { workspace = true, features = [
"json", "json",
"tokio-comp", "tokio-comp",
"connection-manager", "connection-manager",
] } ] }
tracing = { version = "0.1.40", features = ["log"] } tracing = { version = "0.1.40", features = ["log"] }
tracing-subscriber = { version = "0.3.18", features = [ tracing-subscriber = { version = "0.3.18", features = [
"registry", "registry",
"env-filter", "env-filter",
"ansi", "ansi",
"json", "json",
"tracing-log", "tracing-log",
] } ] }
tracing-bunyan-formatter = "0.3.9" tracing-bunyan-formatter = "0.3.9"
sqlx = { workspace = true, default-features = false, features = [ sqlx = { workspace = true, default-features = false, features = [
"runtime-tokio-rustls", "runtime-tokio-rustls",
"macros", "macros",
"postgres", "postgres",
"uuid", "uuid",
"chrono", "chrono",
"migrate", "migrate",
] } ] }
async-trait.workspace = true async-trait.workspace = true
prometheus-client.workspace = true prometheus-client.workspace = true
@ -129,10 +129,10 @@ infra = { path = "libs/infra" }
authentication.workspace = true authentication.workspace = true
access-control.workspace = true access-control.workspace = true
app-error = { workspace = true, features = [ app-error = { workspace = true, features = [
"sqlx_error", "sqlx_error",
"actix_web_error", "actix_web_error",
"tokio_error", "tokio_error",
"appflowy_ai_error", "appflowy_ai_error",
] } ] }
shared-entity = { path = "libs/shared-entity", features = ["cloud"] } shared-entity = { path = "libs/shared-entity", features = ["cloud"] }
workspace-template = { workspace = true } workspace-template = { workspace = true }
@ -165,11 +165,11 @@ assert-json-diff = "2.0.2"
scraper = "0.17.1" scraper = "0.17.1"
client-api-test = { path = "libs/client-api-test", features = ["collab-sync"] } client-api-test = { path = "libs/client-api-test", features = ["collab-sync"] }
client-api = { path = "libs/client-api", features = [ client-api = { path = "libs/client-api", features = [
"collab-sync", "collab-sync",
"test_util", "test_util",
"sync_verbose_log", "sync_verbose_log",
"test_fast_sync", "test_fast_sync",
"enable_brotli", "enable_brotli",
] } ] }
opener = "0.6.1" opener = "0.6.1"
image = "0.23.14" image = "0.23.14"
@ -191,37 +191,37 @@ path = "src/lib.rs"
[workspace] [workspace]
members = [ members = [
# libs # libs
"libs/snowflake", "libs/snowflake",
"libs/collab-rt-entity", "libs/collab-rt-entity",
"libs/database", "libs/database",
"libs/database-entity", "libs/database-entity",
"libs/client-api", "libs/client-api",
"libs/infra", "libs/infra",
"libs/shared-entity", "libs/shared-entity",
"libs/gotrue", "libs/gotrue",
"libs/gotrue-entity", "libs/gotrue-entity",
"admin_frontend", "admin_frontend",
"libs/app-error", "libs/app-error",
"libs/workspace-template", "libs/workspace-template",
"libs/encrypt", "libs/encrypt",
"libs/authentication", "libs/authentication",
"libs/access-control", "libs/access-control",
"libs/collab-rt-protocol", "libs/collab-rt-protocol",
"libs/collab-stream", "libs/collab-stream",
"libs/client-websocket", "libs/client-websocket",
"libs/client-api-test", "libs/client-api-test",
"libs/wasm-test", "libs/wasm-test",
"libs/client-api-wasm", "libs/client-api-wasm",
"libs/appflowy-ai-client", "libs/appflowy-ai-client",
"libs/client-api-entity", "libs/client-api-entity",
# services # services
"services/appflowy-collaborate", "services/appflowy-collaborate",
"services/appflowy-worker", "services/appflowy-worker",
# xtask # xtask
"xtask", "xtask",
"libs/tonic-proto", "libs/tonic-proto",
"libs/mailer", "libs/mailer",
] ]
[workspace.dependencies] [workspace.dependencies]
@ -250,9 +250,9 @@ uuid = { version = "1.6.1", features = ["v4", "v5"] }
anyhow = "1.0.79" anyhow = "1.0.79"
actix = "0.13.3" actix = "0.13.3"
actix-web = { version = "4.5.1", default-features = false, features = [ actix-web = { version = "4.5.1", default-features = false, features = [
"openssl", "openssl",
"compress-brotli", "compress-brotli",
"compress-gzip", "compress-gzip",
] } ] }
actix-http = { version = "3.6.0", default-features = false } actix-http = { version = "3.6.0", default-features = false }
tokio = { version = "1.36.0", features = ["sync"] } tokio = { version = "1.36.0", features = ["sync"] }

View File

@ -3,6 +3,7 @@ use async_trait::async_trait;
use redis::aio::ConnectionManager; use redis::aio::ConnectionManager;
use redis::Value; use redis::Value;
use std::time::{Duration, SystemTime, UNIX_EPOCH}; use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tracing::log;
const RELEASE_SCRIPT: &str = r#" const RELEASE_SCRIPT: &str = r#"
if redis.call("GET", KEYS[1]) == ARGV[1] then if redis.call("GET", KEYS[1]) == ARGV[1] then
@ -45,11 +46,11 @@ impl LeaseAcquisition {
impl Drop for LeaseAcquisition { impl Drop for LeaseAcquisition {
fn drop(&mut self) { fn drop(&mut self) {
if let Some(conn) = self.conn.take() { if let Some(conn) = self.conn.take() {
tokio::spawn(Self::release_internal( tokio::spawn(async move {
conn, if let Err(err) = Self::release_internal(conn, self.stream_key.clone(), self.token).await {
self.stream_key.clone(), log::error!("error while releasing lease (drop): {}", err);
self.token, }
)); });
} }
} }
} }

View File

@ -583,7 +583,7 @@ impl From<u8> for UpdateFlags {
impl Display for UpdateFlags { impl Display for UpdateFlags {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
if self.is_v2_encoded() { if !self.is_v2_encoded() {
write!(f, ".v1")?; write!(f, ".v1")?;
} else { } else {
write!(f, ".v2")?; write!(f, ".v2")?;

View File

@ -53,7 +53,7 @@ then
cargo sqlx prepare --workspace cargo sqlx prepare --workspace
fi fi
cargo run --release --package xtask cargo run --package xtask
# revert to require signup email verification # revert to require signup email verification
export GOTRUE_MAILER_AUTOCONFIRM=false export GOTRUE_MAILER_AUTOCONFIRM=false