1
0

Compiler improvements (#753)

* basic redis add

* toml; reverted unnecessary changes

* merge issues

* increased test connections

---------

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
Wyatt Verchere
2023-11-19 19:10:13 -08:00
committed by GitHub
parent e06a77af28
commit dfba6c7c91
22 changed files with 307 additions and 140 deletions

View File

@@ -103,6 +103,8 @@ impl Organization {
{
use futures::stream::TryStreamExt;
let mut redis = redis.connect().await?;
if organization_strings.is_empty() {
return Ok(Vec::new());
}
@@ -120,11 +122,12 @@ impl Organization {
organization_ids.append(
&mut redis
.multi_get::<i64, _>(
.multi_get::<i64>(
ORGANIZATIONS_TITLES_NAMESPACE,
organization_strings
.iter()
.map(|x| x.to_string().to_lowercase()),
.map(|x| x.to_string().to_lowercase())
.collect::<Vec<_>>(),
)
.await?
.into_iter()
@@ -134,7 +137,10 @@ impl Organization {
if !organization_ids.is_empty() {
let organizations = redis
.multi_get::<String, _>(ORGANIZATIONS_NAMESPACE, organization_ids)
.multi_get::<String>(
ORGANIZATIONS_NAMESPACE,
organization_ids.iter().map(|x| x.to_string()),
)
.await?;
for organization in organizations {
@@ -197,8 +203,8 @@ impl Organization {
redis
.set(
ORGANIZATIONS_TITLES_NAMESPACE,
organization.title.to_lowercase(),
organization.id.0,
&organization.title.to_lowercase(),
&organization.id.0.to_string(),
None,
)
.await?;
@@ -318,6 +324,8 @@ impl Organization {
title: Option<String>,
redis: &RedisPool,
) -> Result<(), super::DatabaseError> {
let mut redis = redis.connect().await?;
redis
.delete_many([
(ORGANIZATIONS_NAMESPACE, Some(id.0.to_string())),