1
0
Fork 0
forked from alemi/upub

fix: distinct doesnt work because published...

it differs by few microseconds but it still differs so duplicates
This commit is contained in:
əlemi 2024-06-08 16:34:40 +02:00
parent f664cb1cbe
commit e7b25bfe1d
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -68,6 +68,7 @@ impl Addresser for crate::Context {
async fn address_to(ctx: &crate::Context, to: Vec<String>, aid: Option<i64>, oid: Option<i64>, local: bool, tx: &impl ConnectionTrait) -> Result<(), DbErr> { async fn address_to(ctx: &crate::Context, to: Vec<String>, aid: Option<i64>, oid: Option<i64>, local: bool, tx: &impl ConnectionTrait) -> Result<(), DbErr> {
// TODO address_to became kind of expensive, with these two selects right away and then another // TODO address_to became kind of expensive, with these two selects right away and then another
// select for each target we're addressing to... can this be improved?? // select for each target we're addressing to... can this be improved??
let now = chrono::Utc::now();
let mut addressing = Vec::new(); let mut addressing = Vec::new();
for target in to.into_iter() for target in to.into_iter()
.filter(|to| !to.is_empty()) .filter(|to| !to.is_empty())
@ -91,7 +92,7 @@ async fn address_to(ctx: &crate::Context, to: Vec<String>, aid: Option<i64>, oid
actor: Set(actor), actor: Set(actor),
activity: Set(aid), activity: Set(aid),
object: Set(oid), object: Set(oid),
published: Set(chrono::Utc::now()), published: Set(now),
} }
); );
} }