cheeaun / cheeaun/phanpy

Repeated GET of /api/v1/notifications Every Few Seconds

Open
#608 7 comments 0 reactions 0 assignees View on GitHub
need investigation
Dominant language
JavaScript
Stars
1.5k
Forks
186
Avg merge
1d 36m
Merged PRs (30d)
11

Description

**Describe the bug**

Phanpy repeatedly calls `GET /api/v1/notifications?limit=1&since_id=X` once every few seconds. After force-reloading Phanpy, the rate dies down, but after a while (unknown how long) it picks up again.

- Which site: `phanpy.ersei.net`
- Which site version: `2024.07.22.4c0bc62` and `2024.08.01.818f58b`
- Which instance: `social.ersei.net`

**To Reproduce**
Steps to reproduce the behavior:
1. Log into Phanpy
2. Normal use of Phanpy (DMs, posting, etc) without closing/reloading the page for a while
3. View webserver access logs

**Expected behavior**

Phanpy uses the streaming APIs and does not call the notification API every second.

**Desktop (please complete the following information):**
- OS: NixOS
- Browser: Firefox
- Version: 128.0.3

**Additional context**
Add any other context about the problem here.

According to @vyrcossont, this is not a localized issue and she has seen it happen before as well, after Phanpy has been running for a while.

The first spike down coincides with rebooting my computer (and this restarting Phanpy) and the second spike down is from a force-refresh:

![log-vol2](https://github.com/user-attachments/assets/78c3f42b-8d99-4407-b759-318285dba0e3)

Notification rate remains steady while Phanpy is not being actively used but in the background (see plateau when I was asleep/not at computer) but when Phanpy is in use, the notification rate rises sharply.

Custom `.env`:

```
PHANPY_CLIENT_NAME=Phanpy
PHANPY_WEBSITE=https://phanpy.ersei.net
PHANPY_LINGVA_INSTANCES=""
PHANPY_DEFAULT_INSTANCE="social.ersei.net"
PHANPY_PRIVACY_POLICY_URL="https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD"
VITE_APP_ENV=production
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with Phanpy left open during normal use, then inspect network activity and the webserver access logs for repeated GET /api/v1/notifications?limit=1&since_id=X requests. Compare this with the streaming APIs described in the issue. Done means notification updates no longer poll every few seconds while the app is running normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.