feat: enhance user-agent identification and implement backoff strategy for university source requests

- Added PSU_CONTACT environment variable to docker-compose for owner contact in User-Agent.
- Updated source.js to include user-agent construction with service version and contact information.
- Implemented exponential backoff strategy for failed requests to the university, with retry logic based on HTTP response status.
- Modified status.js to display backoff information in the status response.
- Adjusted watch.js to reduce request frequency during university downtime.
- Enhanced test coverage with new backoff.test.js to validate backoff behavior and user-agent format.
This commit is contained in:
2026-10-22 01:17:54 +03:00
parent 10c85e3bb9
commit c0487e4c2a
9 changed files with 82503 additions and 81477 deletions

View File

@@ -28,8 +28,10 @@ before(async () => {
TELEGRAM_API: `http://127.0.0.1:${telegram.address().port}`,
PSU_PUBLIC_URL: "https://psu.example",
PSU_ALERT_SOURCE_DOWN_MS: "0",
// Every check reaches the stand-in, however soon after the last one.
// Every check reaches the stand-in, however soon after the last one, even while it is down
// (the pause after failures has its own test, backoff.test.js).
PSU_MIN_REFRESH_MS: "0",
PSU_SOURCE_BACKOFF_MS: "0",
DASHBOARD_PASSWORD: "secret",
});
watch = await import("../server/watch.js");