Skip to content

Commit

Permalink
chore: Upgrade svix to 1.42.0 (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
azhur authored Dec 1, 2024
1 parent 262d092 commit cfc0016
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ members = [
[workspace.package]
license = "AGPL-3.0-only"
edition = "2021"
rust-version = "1.82"
rust-version = "1.83"
repository = "https://github.com/meteroid-oss/meteroid"

[workspace.dependencies]
Expand Down Expand Up @@ -136,7 +136,7 @@ serde_qs = "0.13.0"
serde_yaml = "0.9.30"
sha2 = "0.10.8"
shellexpand = "3.1.0"
svix = { version = "1.41.0", default-features = false }
svix = { version = "1.42.0", default-features = false }
syn = "2.0.52"
strum = { version = "0.26", default-features = false }
tap = "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/distributed-lock/src/locks/postgres_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct LockResult {
// Use Postgres advisory locks for our locking mechanism.
// This is just an example and can be enhanced further.
#[async_trait::async_trait]
impl<'a> DistributedLock for PostgresLock<'a> {
impl DistributedLock for PostgresLock<'_> {
async fn acquire(&mut self) -> Result<bool, LockError> {
sql_query("SELECT pg_try_advisory_lock($1) as acquired")
.bind::<diesel::sql_types::BigInt, _>(self.lock_key.get())
Expand Down
2 changes: 1 addition & 1 deletion docker/develop/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
- meteroid_net

svix-server:
image: "docker.io/svix/svix-server:v1.41.0"
image: "docker.io/svix/svix-server:v1.42.0"
environment:
SVIX_JWT_SECRET: ${SVIX_JWT_SECRET:-changeMeSecret}
SVIX_DB_DSN: postgresql://${DATABASE_USER:-meteroid}:${DATABASE_PASSWORD:-meteroid}@pgbouncer/svix
Expand Down
2 changes: 2 additions & 0 deletions modules/adapters/slurm-collector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const SACCT_FIELDS: [&str; 9] = [
];

impl SacctExecutor for SacctExecutorImpl {
// todo remove clippy ignore and call child.wait() to avoid zombie processes
#[allow(clippy::zombie_processes)]
fn sacct(&self, since: DateTime<Utc>) -> Result<BoxStream<Result<SacctData>>> {
let since_str = since.format(SACCT_DATETIME_FORMAT).to_string();

Expand Down
3 changes: 3 additions & 0 deletions modules/meteroid/crates/meteroid-grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ pbjson-build = "0.6.2"
default = ["client"]
server = []
client = []

[lints.clippy]
needless_lifetimes = "allow"
2 changes: 1 addition & 1 deletion modules/meteroid/crates/meteroid-store/src/domain/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ pub enum OrderByRequest {
pub struct WebhookPage<T> {
pub data: Vec<T>,
pub done: bool,
pub iterator: String,
pub iterator: Option<String>,
pub prev_iterator: Option<String>,
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ message ListWebhookEndpointsRequest {
message ListWebhookEndpointsResponse {
repeated WebhookEndpointListItem data = 1;
bool done = 2;
string iterator = 3;
optional string iterator = 3;
optional string prev_iterator = 4;
}

Expand Down
20 changes: 11 additions & 9 deletions modules/meteroid/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let query_service_client = UsageQueryServiceClient::new(metering_layered_channel.clone());
let metering_service = MetersServiceClient::new(metering_layered_channel);

let svix = Arc::new(svix::api::Svix::new(
config.svix_jwt_token.expose_secret().clone(),
Some(svix::api::SvixOptions {
debug: true,
server_url: Some(config.svix_server_url.clone()),
timeout: Some(std::time::Duration::from_secs(30)),
}),
));
let svix = config.svix_server_url.clone().map(|x| {
Arc::new(svix::api::Svix::new(
config.svix_jwt_token.expose_secret().clone(),
Some(svix::api::SvixOptions {
debug: true,
server_url: Some(x),
timeout: Some(std::time::Duration::from_secs(30)),
}),
))
});

let store = meteroid_store::Store::new(StoreConfig {
database_url: config.database_url.clone(),
Expand All @@ -59,7 +61,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
query_service_client,
metering_service,
)),
svix: Some(svix.clone()),
svix: svix.clone(),
})?;
// todo this is a hack to register the event types in svix, should be managed by an api
store.insert_webhook_out_event_types().await?;
Expand Down
4 changes: 2 additions & 2 deletions modules/meteroid/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub struct Config {
#[envconfig(from = "GOTENBERG_URL", default = "http://localhost:3000")]
pub gotenberg_url: String,

#[envconfig(from = "SVIX_SERVER_URL", default = "http://localhost:8071")]
pub svix_server_url: String,
#[envconfig(from = "SVIX_SERVER_URL")]
pub svix_server_url: Option<String>,

#[envconfig(from = "SVIX_JWT_TOKEN")]
pub svix_jwt_token: SecretString,
Expand Down
2 changes: 1 addition & 1 deletion modules/meteroid/tests/integration/meteroid_it/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn mocked_config(
fang_ext: FangExtConfig::init_from_env().unwrap(),
openexchangerates_api_key: None,
gotenberg_url: "http://localhost:3000".to_owned(),
svix_server_url: "http://localhost:8071".to_owned(),
svix_server_url: Some("http://localhost:8071".to_owned()),
svix_jwt_token: "fake".to_owned().into(),
}
}

0 comments on commit cfc0016

Please sign in to comment.