Debug share dedup
This commit is contained in:
parent
7283ba134c
commit
00004a3239
1 changed files with 14 additions and 9 deletions
23
app/boxes.py
23
app/boxes.py
|
@ -1655,18 +1655,23 @@ async def _handle_announce_activity(
|
||||||
# stream if it's not already there, from an followed actor
|
# stream if it's not already there, from an followed actor
|
||||||
# and if we haven't seen it recently
|
# and if we haven't seen it recently
|
||||||
skip_delta = timedelta(hours=1)
|
skip_delta = timedelta(hours=1)
|
||||||
if (
|
delta_from_original = now() - as_utc(
|
||||||
now() - as_utc(relates_to_inbox_object.ap_published_at) # type: ignore
|
relates_to_inbox_object.ap_published_at # type: ignore
|
||||||
) < skip_delta or (
|
)
|
||||||
await db_session.scalar(
|
if (delta_from_original) < skip_delta or (
|
||||||
select(func.count(func.distinct(models.InboxObject.id))).where(
|
dup_count := (
|
||||||
models.InboxObject.ap_type == "Announce",
|
await db_session.scalar(
|
||||||
models.InboxObject.ap_published_at > now() - skip_delta,
|
select(func.count(models.InboxObject.id)).where(
|
||||||
models.InboxObject.relates_to_inbox_object_id
|
models.InboxObject.ap_type == "Announce",
|
||||||
== relates_to_inbox_object.id,
|
models.InboxObject.ap_published_at > now() - skip_delta,
|
||||||
|
models.InboxObject.relates_to_inbox_object_id
|
||||||
|
== relates_to_inbox_object.id,
|
||||||
|
models.InboxObject.is_hidden_from_stream.is_(False),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) > 0:
|
) > 0:
|
||||||
|
logger.info(f"Deduping Announce {delta_from_original=}/{dup_count=}")
|
||||||
announce_activity.is_hidden_from_stream = True
|
announce_activity.is_hidden_from_stream = True
|
||||||
else:
|
else:
|
||||||
announce_activity.is_hidden_from_stream = not is_from_following
|
announce_activity.is_hidden_from_stream = not is_from_following
|
||||||
|
|
Loading…
Reference in a new issue