Fix Redis BLPOP return type: handle (key, value) tuple
All checks were successful
BotServer CI / build (push) Successful in 13m52s
All checks were successful
BotServer CI / build (push) Successful in 13m52s
This commit is contained in:
parent
5d3174b24e
commit
47e1013700
1 changed files with 3 additions and 2 deletions
|
|
@ -76,9 +76,10 @@ impl WhatsAppMessageQueue {
|
||||||
async fn process_next(&self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn process_next(&self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let mut conn = self.redis_client.get_multiplexed_async_connection().await?;
|
let mut conn = self.redis_client.get_multiplexed_async_connection().await?;
|
||||||
|
|
||||||
let result: Option<String> = conn.blpop(Self::QUEUE_KEY, 5.0).await?;
|
// BLPOP returns (key, value) tuple
|
||||||
|
let result: Option<(String, String)> = conn.blpop(Self::QUEUE_KEY, 5.0).await?;
|
||||||
|
|
||||||
if let Some(json) = result {
|
if let Some((_key, json)) = result {
|
||||||
let msg: QueuedWhatsAppMessage = serde_json::from_str(&json)?;
|
let msg: QueuedWhatsAppMessage = serde_json::from_str(&json)?;
|
||||||
|
|
||||||
// Check and enforce rate limit for this recipient
|
// Check and enforce rate limit for this recipient
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue