Skip to content

angee.parties.tasks

Celery task wrappers for parties' evidence-backed handle suggesters.

refresh_handle_suggestions

python
@shared_task(
    name="parties.refresh_handle_suggestions",
    autoretry_for=(Exception, ),
    retry_backoff=True,
    retry_kwargs={"max_retries": 3},
)
def refresh_handle_suggestions(timestamp: int | None = None,
                               lookback_hours: float | None = 2.0) -> int

Refresh parties-owned suggestions from current handle and signature evidence.

Display-name evidence is native to parties. Signature evidence is an optional contribution from the downstream messaging addon: the app-registry guard keeps parties independently installable, and the task passes only neutral fragment text/hash plus resolved sender-party ids into the manager owner. Both passes partition evidence by the parties audit owner before making any inference.

Steady-state cost stays proportional to NEW evidence: signature parts are mined only within lookback_hours (2× the hourly beat, so a missed tick still overlaps) — PhoneNumberMatcher over the full historical corpus is hours of work, and parts are append-only so old fragments never change. Pass None for the full sweep (first install, extraction-rule changes). The advisory task lock keeps a slow sweep from stacking onto the next tick.

Released under the AGPL-3.0 License.