Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / module

notify

codeintel.notify

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Contains (5)
SymbolFileResolved by
_parsenotify.pysame file
get_notifiernotify.pysame file
Notifiernotify.pysame file
RedisNotifiernotify.pysame file
UpstashRestNotifiernotify.pysame file
Imported by (1)
SymbolFileResolved by
routerrouter.pythrough an import
codeintel.notifybackend/app/codeintel/notify.py, lines 1–40Open source
"""Job wake-up notifications (Redis), with the database as the fallback.Notifications are an optimisation: they let an idle worker block on a cheapRedis BLPOP instead of polling PostgreSQL (which would keep a serverlessdatabase awake). They are allowed to be lost or duplicated — see``jobs.py``. The payload ``{"job_id": "..."}`` is pushed to the existing``ingest_queue`` key by default, so the production edge worker(``main_worker.py``), which already BLPOPs that key, picks jobs up withoutan extra Redis connection.Backends, chosen by :func:`get_notifier`:* ``REDIS_URL`` (``redis://`` or Upstash's ``rediss://``) — redis-py;* ``UPSTASH_REDIS_REST_URL`` + token — Upstash REST over https;* neither — no notifications; workers poll the database."""from __future__ import annotationsimport jsonimport loggingimport timelogger = logging.getLogger(__name__)class Notifier:    name = "none"    def notify(self, job_id: str) -> bool:        return False    def wait(self, timeout: int) -> str | None:        time.sleep(timeout)        return Nonedef _parse(raw) -> str | None:    if raw is None:        return None

Shows the first 40 of 120 lines. The rest is on GitHub at this commit.

What the index recorded

Signature
module backend.app.codeintel.notify
File
backend/app/codeintel/notify.py
Lines
1–120
Parser
python-ast
Git blob
fc15788e6d2a98f2857ebab4c81c9c193abb5873
Call sites
1 named, 0 resolved, 1 left unlinked
Outside this subset
4 more edges reach code outside the graph shown here

Read it on GitHub at this commit