Convert jobs to messages
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
		@@ -533,4 +533,22 @@ impl RedisDriver {
 | 
			
		||||
        let _: usize = cm.hset_multiple(key, &pairs).await?;
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // -----------------------------
 | 
			
		||||
    // Queues (lists)
 | 
			
		||||
    // -----------------------------
 | 
			
		||||
 | 
			
		||||
    /// Push a value onto a Redis list using LPUSH in the given DB.
 | 
			
		||||
    pub async fn lpush_list(&self, db: u32, list: &str, value: &str) -> Result<()> {
 | 
			
		||||
        let mut cm = self.manager_for_db(db).await?;
 | 
			
		||||
        let _: i64 = cm.lpush(list, value).await?;
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Enqueue a message key onto the outbound queue (msg_out).
 | 
			
		||||
    /// The value is the canonical message key "message:{caller_id}:{id}".
 | 
			
		||||
    pub async fn enqueue_msg_out(&self, db: u32, caller_id: u32, id: u32) -> Result<()> {
 | 
			
		||||
        let key = Self::message_key(caller_id, id);
 | 
			
		||||
        self.lpush_list(db, "msg_out", &key).await
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user