Skip to content

Commit e570bc8

Browse files
authored
Revert "redis tls support (#95)" (#96)
This reverts commit d729f5f.
1 parent d729f5f commit e570bc8

17 files changed

+45
-126
lines changed

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ config = "0.15.11"
9898
aws-arn = "0.3.1"
9999

100100
# Redis
101-
redis = { version = "0.31.0", features = ["connection-manager", "tls-rustls", "tls-rustls-webpki-roots", "tokio-rustls-comp"] }
102-
103-
# Rustls (required for TLS crypto provider selection).
104-
# Rustls 0.23 requires exactly one crypto provider feature (ring or aws-lc-rs).
105-
rustls = { version = "0.23.32", default-features = false, features = ["ring"] }
101+
redis = { version = "0.31.0", features = ["tokio-comp", "connection-manager"] }
106102

107103
# Dev dependencies
108104
criterion = { version = "0.6", features = ["html_reports", "async_tokio"] }

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ thirdweb:
147147

148148
redis:
149149
url: "redis://localhost:6379"
150-
# For Redis over TLS, use the `rediss://` scheme:
151-
# url: "rediss://localhost:6379"
152150

153151
queue:
154152
webhook_workers: 50
@@ -168,8 +166,6 @@ export APP__QUEUE__LOCAL_CONCURRENCY=500
168166

169167
# Custom Redis configuration
170168
export APP__REDIS__URL="redis://redis-cluster:6379"
171-
# For Redis over TLS, use the `rediss://` scheme:
172-
# export APP__REDIS__URL="rediss://redis-cluster:6379"
173169

174170
# Debug logging for development
175171
export RUST_LOG="thirdweb_engine=debug,twmq=debug"

server/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,4 @@ aws-arn = { workspace = true }
5050
moka = { workspace = true }
5151
engine-eip7702-core = { path = "../eip7702-core" }
5252
prometheus = { workspace = true }
53-
thiserror = { workspace = true }
54-
rustls = { workspace = true }
53+
thiserror = { workspace = true }

server/DOCKER.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ The following environment variables must be set when running the container:
2525
```bash
2626
# Redis Configuration
2727
APP__REDIS__URL=redis://localhost:6379
28-
# For Redis over TLS, use the `rediss://` scheme:
29-
# APP__REDIS__URL=rediss://localhost:6379
3028

3129
# Thirdweb Configuration
3230
APP__THIRDWEB__SECRET=your_secret_key_here
@@ -70,8 +68,6 @@ Create a `.env` file with your configuration:
7068
```bash
7169
# .env file
7270
APP__REDIS__URL=redis://localhost:6379
73-
# For Redis over TLS, use the `rediss://` scheme:
74-
# APP__REDIS__URL=rediss://localhost:6379
7571
APP__THIRDWEB__SECRET=your_secret_key_here
7672
APP__THIRDWEB__CLIENT_ID=your_client_id_here
7773
APP__THIRDWEB__URLS__RPC=https://your-rpc-url.com
@@ -132,8 +128,6 @@ services:
132128
- "8080:8080"
133129
environment:
134130
- APP__REDIS__URL=redis://redis:6379
135-
# For Redis over TLS, use the `rediss://` scheme:
136-
# - APP__REDIS__URL=rediss://redis:6379
137131
- APP__THIRDWEB__SECRET=${APP__THIRDWEB__SECRET}
138132
- APP__THIRDWEB__CLIENT_ID=${APP__THIRDWEB__CLIENT_ID}
139133
- APP__THIRDWEB__URLS__RPC=${APP__THIRDWEB__URLS__RPC}

server/src/main.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ async fn main() -> anyhow::Result<()> {
7070
});
7171
let eoa_signer = Arc::new(EoaSigner::new(vault_client.clone(), iaw_client.clone()));
7272
let solana_signer = Arc::new(SolanaSigner::new(vault_client.clone(), iaw_client));
73-
74-
// Rustls 0.23 requires selecting a process-level CryptoProvider (ring or aws-lc-rs)
75-
// before any TLS client configuration is created (e.g. when using `rediss://`).
76-
// If another crate already installed a provider, this will be a no-op error.
77-
if let Err(e) = rustls::crypto::ring::default_provider().install_default() {
78-
tracing::debug!(error = ?e, "Rustls CryptoProvider already installed");
79-
}
80-
8173
let redis_client = twmq::redis::Client::open(config.redis.url.as_str())?;
8274

8375
let authorization_cache = EoaAuthorizationCache::new(

twmq/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ thiserror = { workspace = true }
1414
tracing = { workspace = true }
1515
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
1616
futures = { workspace = true }
17-
rustls = { workspace = true }
1817

1918
[dev-dependencies]
2019
tokio = { workspace = true, features = ["full"] }

twmq/src/lib.rs

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -175,63 +175,52 @@ impl<H: DurableExecution> Queue<H> {
175175
&self.name
176176
}
177177

178-
/// Redis Cluster hash tag used to keep all queue keys in the same slot.
179-
/// See: https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec/#hash-tags
180-
fn redis_hash_tag(&self) -> String {
181-
format!("{{{}}}", self.name())
182-
}
183-
184178
pub fn pending_list_name(&self) -> String {
185-
format!("twmq:{}:pending", self.redis_hash_tag())
179+
format!("twmq:{}:pending", self.name())
186180
}
187181

188182
pub fn active_hash_name(&self) -> String {
189-
format!("twmq:{}:active", self.redis_hash_tag())
183+
format!("twmq:{}:active", self.name)
190184
}
191185

192186
pub fn delayed_zset_name(&self) -> String {
193-
format!("twmq:{}:delayed", self.redis_hash_tag())
187+
format!("twmq:{}:delayed", self.name)
194188
}
195189

196190
pub fn success_list_name(&self) -> String {
197-
format!("twmq:{}:success", self.redis_hash_tag())
191+
format!("twmq:{}:success", self.name)
198192
}
199193

200194
pub fn failed_list_name(&self) -> String {
201-
format!("twmq:{}:failed", self.redis_hash_tag())
195+
format!("twmq:{}:failed", self.name)
202196
}
203197

204198
pub fn job_data_hash_name(&self) -> String {
205-
format!("twmq:{}:jobs:data", self.redis_hash_tag())
199+
format!("twmq:{}:jobs:data", self.name)
206200
}
207201

208202
pub fn job_meta_hash_name(&self, job_id: &str) -> String {
209-
format!("twmq:{}:job:{}:meta", self.redis_hash_tag(), job_id)
203+
format!("twmq:{}:job:{}:meta", self.name, job_id)
210204
}
211205

212206
pub fn job_errors_list_name(&self, job_id: &str) -> String {
213-
format!("twmq:{}:job:{}:errors", self.redis_hash_tag(), job_id)
207+
format!("twmq:{}:job:{}:errors", self.name, job_id)
214208
}
215209

216210
pub fn job_result_hash_name(&self) -> String {
217-
format!("twmq:{}:jobs:result", self.redis_hash_tag())
211+
format!("twmq:{}:jobs:result", self.name)
218212
}
219213

220214
pub fn dedupe_set_name(&self) -> String {
221-
format!("twmq:{}:dedup", self.redis_hash_tag())
215+
format!("twmq:{}:dedup", self.name)
222216
}
223217

224218
pub fn pending_cancellation_set_name(&self) -> String {
225-
format!("twmq:{}:pending_cancellations", self.redis_hash_tag())
219+
format!("twmq:{}:pending_cancellations", self.name)
226220
}
227221

228222
pub fn lease_key_name(&self, job_id: &str, lease_token: &str) -> String {
229-
format!(
230-
"twmq:{}:job:{}:lease:{}",
231-
self.redis_hash_tag(),
232-
job_id,
233-
lease_token
234-
)
223+
format!("twmq:{}:job:{}:lease:{}", self.name, job_id, lease_token)
235224
}
236225

237226
pub async fn push(
@@ -312,8 +301,7 @@ impl<H: DurableExecution> Queue<H> {
312301
let position_string = delay.position.to_string();
313302

314303
let _result: (i32, String) = script
315-
// Redis Cluster: all KEYS must be in the same slot
316-
.key(self.redis_hash_tag())
304+
.key(&self.name)
317305
.key(self.delayed_zset_name())
318306
.key(self.pending_list_name())
319307
.key(self.job_data_hash_name())
@@ -754,8 +742,7 @@ impl<H: DurableExecution> Queue<H> {
754742
Vec<String>,
755743
Vec<String>,
756744
) = script
757-
// Redis Cluster: all KEYS must be in the same slot
758-
.key(self.redis_hash_tag())
745+
.key(self.name())
759746
.key(self.delayed_zset_name())
760747
.key(self.pending_list_name())
761748
.key(self.active_hash_name())
@@ -1003,8 +990,7 @@ impl<H: DurableExecution> Queue<H> {
1003990
);
1004991

1005992
let trimmed_count: usize = trim_script
1006-
// Redis Cluster: all KEYS must be in the same slot
1007-
.key(self.redis_hash_tag())
993+
.key(self.name())
1008994
.key(self.success_list_name())
1009995
.key(self.job_data_hash_name())
1010996
.key(self.job_result_hash_name()) // results_hash
@@ -1182,8 +1168,7 @@ impl<H: DurableExecution> Queue<H> {
11821168
);
11831169

11841170
let trimmed_count: usize = trim_script
1185-
// Redis Cluster: all KEYS must be in the same slot
1186-
.key(self.redis_hash_tag())
1171+
.key(self.name())
11871172
.key(self.failed_list_name())
11881173
.key(self.job_data_hash_name())
11891174
.key(self.dedupe_set_name())

twmq/src/multilane.rs

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -84,89 +84,59 @@ impl<H: DurableExecution> MultilaneQueue<H> {
8484
&self.queue_id
8585
}
8686

87-
/// Redis Cluster hash tag used to keep all multilane keys in the same slot.
88-
fn redis_hash_tag(&self) -> String {
89-
format!("{{{}}}", self.queue_id())
90-
}
91-
9287
// Redis key naming methods with proper multilane namespacing
9388
pub fn lanes_zset_name(&self) -> String {
94-
format!("twmq_multilane:{}:lanes", self.redis_hash_tag())
89+
format!("twmq_multilane:{}:lanes", self.queue_id)
9590
}
9691

9792
pub fn lane_pending_list_name(&self, lane_id: &str) -> String {
98-
format!(
99-
"twmq_multilane:{}:lane:{}:pending",
100-
self.redis_hash_tag(),
101-
lane_id
102-
)
93+
format!("twmq_multilane:{}:lane:{}:pending", self.queue_id, lane_id)
10394
}
10495

10596
pub fn lane_delayed_zset_name(&self, lane_id: &str) -> String {
106-
format!(
107-
"twmq_multilane:{}:lane:{}:delayed",
108-
self.redis_hash_tag(),
109-
lane_id
110-
)
97+
format!("twmq_multilane:{}:lane:{}:delayed", self.queue_id, lane_id)
11198
}
11299

113100
pub fn lane_active_hash_name(&self, lane_id: &str) -> String {
114-
format!(
115-
"twmq_multilane:{}:lane:{}:active",
116-
self.redis_hash_tag(),
117-
lane_id
118-
)
101+
format!("twmq_multilane:{}:lane:{}:active", self.queue_id, lane_id)
119102
}
120103

121104
pub fn success_list_name(&self) -> String {
122-
format!("twmq_multilane:{}:success", self.redis_hash_tag())
105+
format!("twmq_multilane:{}:success", self.queue_id)
123106
}
124107

125108
pub fn failed_list_name(&self) -> String {
126-
format!("twmq_multilane:{}:failed", self.redis_hash_tag())
109+
format!("twmq_multilane:{}:failed", self.queue_id)
127110
}
128111

129112
pub fn job_data_hash_name(&self) -> String {
130-
format!("twmq_multilane:{}:jobs:data", self.redis_hash_tag())
113+
format!("twmq_multilane:{}:jobs:data", self.queue_id)
131114
}
132115

133116
pub fn job_meta_hash_name(&self, job_id: &str) -> String {
134-
format!(
135-
"twmq_multilane:{}:job:{}:meta",
136-
self.redis_hash_tag(),
137-
job_id
138-
)
117+
format!("twmq_multilane:{}:job:{}:meta", self.queue_id, job_id)
139118
}
140119

141120
pub fn job_errors_list_name(&self, job_id: &str) -> String {
142-
format!(
143-
"twmq_multilane:{}:job:{}:errors",
144-
self.redis_hash_tag(),
145-
job_id
146-
)
121+
format!("twmq_multilane:{}:job:{}:errors", self.queue_id, job_id)
147122
}
148123

149124
pub fn job_result_hash_name(&self) -> String {
150-
format!("twmq_multilane:{}:jobs:result", self.redis_hash_tag())
125+
format!("twmq_multilane:{}:jobs:result", self.queue_id)
151126
}
152127

153128
pub fn dedupe_set_name(&self) -> String {
154-
format!("twmq_multilane:{}:dedup", self.redis_hash_tag())
129+
format!("twmq_multilane:{}:dedup", self.queue_id)
155130
}
156131

157132
pub fn pending_cancellation_set_name(&self) -> String {
158-
format!(
159-
"twmq_multilane:{}:pending_cancellations",
160-
self.redis_hash_tag()
161-
)
133+
format!("twmq_multilane:{}:pending_cancellations", self.queue_id)
162134
}
163135

164136
pub fn lease_key_name(&self, job_id: &str, lease_token: &str) -> String {
165137
format!(
166138
"twmq_multilane:{}:job:{}:lease:{}",
167-
self.redis_hash_tag(),
168-
job_id,
169-
lease_token
139+
self.queue_id, job_id, lease_token
170140
)
171141
}
172142

@@ -259,8 +229,7 @@ impl<H: DurableExecution> MultilaneQueue<H> {
259229
.key(self.job_data_hash_name())
260230
.key(self.job_meta_hash_name(&job.id))
261231
.key(self.dedupe_set_name())
262-
// Redis Cluster: ensure constructed keys match hash-tagged names
263-
.arg(self.redis_hash_tag())
232+
.arg(&self.queue_id)
264233
.arg(lane_id)
265234
.arg(&job_options.id)
266235
.arg(job_data)
@@ -445,8 +414,7 @@ impl<H: DurableExecution> MultilaneQueue<H> {
445414
.key(self.pending_cancellation_set_name())
446415
.key(self.job_meta_hash_name(job_id))
447416
.key(self.job_data_hash_name())
448-
// Redis Cluster: ensure constructed keys match hash-tagged names
449-
.arg(self.redis_hash_tag())
417+
.arg(&self.queue_id)
450418
.arg(job_id)
451419
.arg(now)
452420
.invoke_async(&mut self.redis.clone())
@@ -792,8 +760,7 @@ impl<H: DurableExecution> MultilaneQueue<H> {
792760
.key(self.pending_cancellation_set_name())
793761
.key(self.failed_list_name())
794762
.key(self.success_list_name())
795-
// Redis Cluster: ensure constructed keys match hash-tagged names
796-
.arg(self.redis_hash_tag())
763+
.arg(&self.queue_id)
797764
.arg(now)
798765
.arg(batch_size)
799766
.arg(self.options.lease_duration.as_secs())

twmq/tests/basic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ const REDIS_URL: &str = "redis://127.0.0.1:6379/";
1818
// Helper to clean up Redis keys for a given queue name pattern
1919
async fn cleanup_redis_keys(conn_manager: &ConnectionManager, queue_name: &str) {
2020
let mut conn = conn_manager.clone();
21-
// twmq queue keys are hash-tagged for Redis Cluster compatibility
22-
let keys_pattern = format!("twmq:{{{queue_name}}}:*");
21+
let keys_pattern = format!("twmq:{queue_name}:*");
2322

2423
let keys: Vec<String> = redis::cmd("KEYS")
2524
.arg(&keys_pattern)

twmq/tests/basic_hook.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ use twmq::{
2323
// Helper to clean up Redis keys for a given queue name pattern
2424
async fn cleanup_redis_keys(conn_manager: &ConnectionManager, queue_name: &str) {
2525
let mut conn = conn_manager.clone();
26-
// twmq queue keys are hash-tagged for Redis Cluster compatibility
27-
let keys_pattern = format!("twmq:{{{queue_name}}}:*");
26+
let keys_pattern = format!("twmq:{queue_name}:*");
2827

2928
let keys: Vec<String> = redis::cmd("KEYS")
3029
.arg(&keys_pattern)

0 commit comments

Comments
 (0)