Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Speed Up Mint Random Selects" #270

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/src/entities/collection_mints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub struct Model {
pub credits_deduction_id: Option<Uuid>,
#[sea_orm(nullable)]
pub compressed: Option<bool>,
pub random_pick: i64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
1 change: 0 additions & 1 deletion api/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ impl Processor {
.map_err(ProcessorErrorKind::InvalidSellerFee)?),
credits_deduction_id: Set(None),
compressed: Set(Some(compressed)),
..Default::default()
};

let mint_model = mint_am.insert(self.db.get()).await?;
Expand Down
10 changes: 7 additions & 3 deletions api/src/mutations/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ use hub_core::{
producer::Producer,
};
use redis::AsyncCommands;
use sea_orm::{prelude::*, JoinType, Order, QueryOrder, QuerySelect, Set, TransactionTrait};
use sea_orm::{
prelude::*,
sea_query::{Func, SimpleExpr},
JoinType, Order, QueryOrder, QuerySelect, Set, TransactionTrait,
};

use super::collection::{
fetch_owner, validate_creators, validate_json, validate_solana_creator_verification,
Expand Down Expand Up @@ -1172,7 +1176,7 @@ impl Mutation {
let mint = CollectionMints::find()
.filter(collection_mints::Column::CollectionId.eq(drop.collection_id))
.filter(collection_mints::Column::CreationStatus.eq(CreationStatus::Queued))
.order_by(collection_mints::Column::RandomPick, Order::Asc)
.order_by(SimpleExpr::FunctionCall(Func::random()), Order::Asc)
.one(conn)
.await?
.ok_or(Error::new("No Queued mint found for the drop"))?;
Expand Down Expand Up @@ -1351,7 +1355,7 @@ impl Mutation {
)
.filter(collection_mints::Column::CollectionId.eq(drop.collection_id))
.filter(collection_mints::Column::CreationStatus.eq(CreationStatus::Queued))
.order_by(collection_mints::Column::RandomPick, Order::Asc)
.order_by(SimpleExpr::FunctionCall(Func::random()), Order::Asc)
.limit(Some(batch_size.try_into()?))
.all(conn)
.await?;
Expand Down
1 change: 0 additions & 1 deletion api/src/objects/collection_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ impl From<Model> for CollectionMint {
seller_fee_basis_points,
credits_deduction_id,
compressed,
..
}: Model,
) -> Self {
Self {
Expand Down
4 changes: 1 addition & 3 deletions migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ mod m20230914_154759_add_job_trackings_table;
mod m20230915_111128_create_mints_creation_status_idx;
mod m20230922_150621_nullable_metadata_jsons_identifier_and_uri;
mod m20231011_202917_create_queued_mints_idx;
mod m20231020_123046_add_random_pick_to_collection_mints;

pub struct Migrator;

Expand Down Expand Up @@ -126,11 +125,10 @@ impl MigratorTrait for Migrator {
Box::new(m20230910_204731_add_queued_variant_to_mints_status::Migration),
Box::new(m20230910_212742_make_owner_address_optional_for_mint::Migration),
Box::new(m20230911_144938_make_compressed_column_optional::Migration),
Box::new(m20230914_154759_add_job_trackings_table::Migration),
Box::new(m20230915_111128_create_mints_creation_status_idx::Migration),
Box::new(m20230914_154759_add_job_trackings_table::Migration),
Box::new(m20230922_150621_nullable_metadata_jsons_identifier_and_uri::Migration),
Box::new(m20231011_202917_create_queued_mints_idx::Migration),
Box::new(m20231020_123046_add_random_pick_to_collection_mints::Migration),
]
}
}

This file was deleted.

Loading