mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
chore: bump deps
This commit is contained in:
parent
321ba0bb3d
commit
c8b6dc4c23
15 changed files with 152 additions and 335 deletions
|
|
@ -7,17 +7,18 @@ edition = "2021"
|
|||
anyhow = { workspace = true }
|
||||
axum = { workspace = true }
|
||||
fred = { workspace = true }
|
||||
hyper = { version = "1.3.1", features = ["http1"] }
|
||||
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1"] }
|
||||
lazy_static = { workspace = true }
|
||||
libpk = { path = "../../lib/libpk" }
|
||||
metrics = { workspace = true }
|
||||
prost = { workspace = true }
|
||||
reverse-proxy-service = { version = "0.2.1", features = ["axum"] }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
hyper = { version = "1.3.1", features = ["http1"] }
|
||||
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1"] }
|
||||
reverse-proxy-service = { version = "0.2.1", features = ["axum"] }
|
||||
tower = "0.4.13"
|
||||
tower-http = { version = "0.5.2", features = ["catch-panic"] }
|
||||
tracing = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ mod util;
|
|||
#[derive(Clone)]
|
||||
pub struct ApiContext {
|
||||
pub db: sqlx::postgres::PgPool,
|
||||
pub redis: fred::pool::RedisPool,
|
||||
pub redis: fred::clients::RedisPool,
|
||||
|
||||
rproxy_uri: String,
|
||||
rproxy_client: Client<HttpConnector, Body>,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use axum::{
|
|||
middleware::{FromFnLayer, Next},
|
||||
response::Response,
|
||||
};
|
||||
use fred::{pool::RedisPool, prelude::LuaInterface, types::ReconnectPolicy, util::sha1_hash};
|
||||
use fred::{clients::RedisPool, prelude::LuaInterface, util::sha1_hash, interfaces::ClientLike};
|
||||
use metrics::counter;
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
|
|
@ -27,21 +27,25 @@ pub fn ratelimiter<F, T>(f: F) -> FromFnLayer<F, Option<RedisPool>, T> {
|
|||
.ratelimit_redis_addr
|
||||
.as_ref()
|
||||
.map(|val| {
|
||||
let r = fred::pool::RedisPool::new(
|
||||
// todo: this should probably use the global pool
|
||||
let r = RedisPool::new(
|
||||
fred::types::RedisConfig::from_url_centralized(val.as_ref())
|
||||
.expect("redis url is invalid"),
|
||||
None,
|
||||
None,
|
||||
Some(Default::default()),
|
||||
10,
|
||||
)
|
||||
.expect("failed to connect to redis");
|
||||
|
||||
let handle = r.connect(Some(ReconnectPolicy::default()));
|
||||
let handle = r.connect();
|
||||
|
||||
tokio::spawn(async move { handle });
|
||||
|
||||
let rscript = r.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Ok(()) = rscript.wait_for_connect().await {
|
||||
match rscript.script_load(LUA_SCRIPT).await {
|
||||
match rscript.script_load::<String, String>(LUA_SCRIPT.to_string()).await {
|
||||
Ok(_) => info!("connected to redis for request rate limiting"),
|
||||
Err(err) => error!("could not load redis script: {}", err),
|
||||
}
|
||||
|
|
@ -155,6 +159,8 @@ pub async fn do_request_ratelimited(
|
|||
// local rate = ARGV[1]
|
||||
// local period = ARGV[2]
|
||||
// return {remaining, tostring(retry_after), reset_after}
|
||||
|
||||
// todo: check if error is script not found and reload script
|
||||
let resp = redis
|
||||
.evalsha::<(i32, String, u64), String, Vec<String>, Vec<i32>>(
|
||||
LUA_SCRIPT_SHA.to_string(),
|
||||
|
|
|
|||
|
|
@ -11,19 +11,20 @@ path = "src/cleanup.rs"
|
|||
libpk = { path = "../../lib/libpk" }
|
||||
anyhow = { workspace = true }
|
||||
axum = { workspace = true }
|
||||
data-encoding = "2.5.0"
|
||||
form_urlencoded = "1.2.1"
|
||||
futures = { workspace = true }
|
||||
gif = "0.13.1"
|
||||
image = { version = "0.24.8", default-features = false, features = ["gif", "jpeg", "png", "webp", "tiff"] }
|
||||
reqwest = { workspace = true }
|
||||
rust-s3 = { version = "0.33.0", default-features = false, features = ["tokio-rustls-tls"] }
|
||||
sha2 = "0.10.8"
|
||||
serde = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
thiserror = "1.0.56"
|
||||
time = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
data-encoding = "2.5.0"
|
||||
gif = "0.13.1"
|
||||
image = { version = "0.24.8", default-features = false, features = ["gif", "jpeg", "png", "webp", "tiff"] }
|
||||
form_urlencoded = "1.2.1"
|
||||
rust-s3 = { version = "0.33.0", default-features = false, features = ["tokio-rustls-tls"] }
|
||||
sha2 = "0.10.8"
|
||||
thiserror = "1.0.56"
|
||||
webp = "0.2.6"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
axum = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
|
@ -13,4 +14,3 @@ tracing = { workspace = true }
|
|||
tracing-subscriber = { workspace = true }
|
||||
|
||||
hickory-client = "0.24.1"
|
||||
reqwest = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ fred = { workspace = true }
|
|||
futures = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
libpk = { path = "../../lib/libpk" }
|
||||
metrics = { workspace = true }
|
||||
prost = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
signal-hook = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub fn cluster_config() -> ClusterSettings {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn create_shards(redis: fred::pool::RedisPool) -> anyhow::Result<Vec<Shard<RedisQueue>>> {
|
||||
pub fn create_shards(redis: fred::clients::RedisPool) -> anyhow::Result<Vec<Shard<RedisQueue>>> {
|
||||
let intents = Intents::GUILDS
|
||||
| Intents::DIRECT_MESSAGES
|
||||
| Intents::DIRECT_MESSAGE_REACTIONS
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use fred::{
|
||||
error::RedisError,
|
||||
interfaces::KeysInterface,
|
||||
pool::RedisPool,
|
||||
clients::RedisPool,
|
||||
types::{Expiration, SetOptions},
|
||||
};
|
||||
use std::fmt::Debug;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use bytes::Bytes;
|
||||
use fred::{interfaces::HashesInterface, pool::RedisPool};
|
||||
use fred::{interfaces::HashesInterface, clients::RedisPool};
|
||||
use prost::Message;
|
||||
use tracing::info;
|
||||
use twilight_gateway::Event;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use chrono::Timelike;
|
||||
use fred::{interfaces::*, pool::RedisPool};
|
||||
use fred::{interfaces::*, clients::RedisPool};
|
||||
use signal_hook::{
|
||||
consts::{SIGINT, SIGTERM},
|
||||
iterator::Signals,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue