chore: use rust 1.77 (#493)

This commit is contained in:
Nathan.fooo 2024-04-24 10:47:18 +08:00 committed by GitHub
parent 9545dc82e6
commit 5f970a625a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 21 additions and 34 deletions

View File

@ -11,7 +11,7 @@ env:
SQLX_VERSION: 0.7.1
SQLX_FEATURES: "rustls,postgres"
SQLX_OFFLINE: true
RUST_TOOLCHAIN: "1.75"
RUST_TOOLCHAIN: "1.77"
jobs:
test:

View File

@ -9,7 +9,7 @@ on:
env:
NODE_VERSION: '20.12.0'
RUST_TOOLCHAIN: "1.75"
RUST_TOOLCHAIN: "1.77"
jobs:
build:

View File

@ -30,7 +30,7 @@ on:
env:
NODE_VERSION: '20.12.0'
RUST_TOOLCHAIN: "1.75"
RUST_TOOLCHAIN: "1.77"
jobs:
publish:
runs-on: ubuntu-latest

View File

@ -1,5 +1,5 @@
# Using cargo-chef to manage Rust build cache effectively
FROM lukemathwalker/cargo-chef:latest-rust-1.75.0 as chef
FROM lukemathwalker/cargo-chef:latest-rust-1.77 as chef
WORKDIR /app
RUN apt update && apt install lld clang -y

View File

@ -1,6 +1,6 @@
# User should build from parent directory
FROM lukemathwalker/cargo-chef:latest-rust-1.75 as chef
FROM lukemathwalker/cargo-chef:latest-rust-1.77 as chef
WORKDIR /app
RUN apt update && apt install lld clang -y

View File

@ -428,6 +428,7 @@ impl TestClient {
timeout_secs: u64,
) -> Result<AFSnapshotMetas, AppResponseError> {
let duration = Duration::from_secs(timeout_secs);
#[allow(clippy::blocks_in_conditions)]
match timeout(duration, async {
let mut snapshot_metas = self.get_snapshot_list(workspace_id, object_id).await?;
// Loop until the condition `f` returns true or the timeout is reached

View File

@ -18,7 +18,7 @@ use std::sync::atomic::Ordering;
use std::time::Duration;
use tokio_retry::strategy::{ExponentialBackoff, FixedInterval};
use tokio_retry::{Retry, RetryIf};
use tracing::{event, instrument};
use tracing::{event, info, instrument};
impl Client {
#[instrument(level = "debug", skip_all)]
@ -26,6 +26,7 @@ impl Client {
&self,
params: QueryCollabParams,
) -> Result<EncodedCollab, AppResponseError> {
info!("get collab:{}", params);
// 2 seconds, 4 seconds, 8 seconds
let retry_strategy = ExponentialBackoff::from_millis(2).factor(1000).take(3);
let action = GetCollabAction::new(self.clone(), params);

View File

@ -246,33 +246,6 @@ fn bulk_from_redis_value(v: &Value) -> Result<&Vec<Value>, RedisError> {
}
}
struct UserId(i64);
impl FromRedisValue for UserId {
fn from_redis_value(v: &Value) -> RedisResult<Self> {
match v {
Value::Data(uid_bytes) => {
if uid_bytes.len() == std::mem::size_of::<i64>() {
let mut buf = [0u8; 8];
buf.copy_from_slice(uid_bytes);
let value = i64::from_be_bytes(buf);
Ok(Self(value))
} else {
Err(RedisError::from((
redis::ErrorKind::TypeError,
"Invalid UID length",
format!("Expected 8 bytes, got {}", uid_bytes.len()),
)))
}
},
_ => Err(RedisError::from((
redis::ErrorKind::TypeError,
"Expected Value::Data for UID",
))),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum CollabControlEvent {
Open {

View File

@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::cmp::Ordering;
use std::collections::HashMap;
use std::fmt::Display;
use std::ops::{Deref, DerefMut};
use std::str::FromStr;
use tracing::error;
@ -159,6 +160,16 @@ pub struct QueryCollabParams {
pub inner: QueryCollab,
}
impl Display for QueryCollabParams {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"workspace_id: {}, object_id: {}, collab_type: {:?}",
self.workspace_id, self.object_id, self.collab_type
)
}
}
impl QueryCollabParams {
pub fn new<T1: ToString, T2: ToString>(
object_id: T1,

View File

@ -1,4 +1,4 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.75.0 as chef
FROM lukemathwalker/cargo-chef:latest-rust-1.77 as chef
# Set the initial working directory
WORKDIR /app

View File

@ -245,6 +245,7 @@ where
}
#[instrument(level = "trace", skip(self, params), oid = %params.oid, ty = %params.collab_type, err)]
#[allow(clippy::blocks_in_conditions)]
async fn insert_new_collab_with_transaction(
&self,
workspace_id: &str,