Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / class
UpstashRestNotifier
codeintel.notify.UpstashRestNotifier
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 symbolsLoading
codeintel.notify.UpstashRestNotifierbackend/app/codeintel/notify.py, lines 77–109Open source
class UpstashRestNotifier(Notifier): name = "upstash-rest" def __init__(self, url: str, token: str, key: str) -> None: self.url = url.rstrip("/") self.key = key self._headers = {"Authorization": f"Bearer {token}"} def _cmd(self, command: list, timeout: float) -> object: import httpx resp = httpx.post(self.url, json=command, headers=self._headers, timeout=timeout) resp.raise_for_status() return resp.json().get("result") def notify(self, job_id: str) -> bool: try: self._cmd(["RPUSH", self.key, json.dumps({"job_id": job_id})], timeout=10) return True except Exception as exc: logger.warning("Job notification failed (job stays queued in the DB): %s", type(exc).__name__) return False def wait(self, timeout: int) -> str | None: try: result = self._cmd(["BLPOP", self.key, str(timeout)], timeout=timeout + 15) except Exception as exc: logger.warning("Upstash BLPOP failed (%s); falling back to DB polling", type(exc).__name__) time.sleep(min(timeout, 5)) return None if isinstance(result, list) and len(result) == 2: return _parse(result[1]) return NoneWhat the index recorded
- Signature
class UpstashRestNotifier(Notifier):- File
backend/app/codeintel/notify.py- Lines
- 77–109
- Parser
- python-ast
- Git blob
fc15788e6d2a98f2857ebab4c81c9c193abb5873
