Compare commits

..
Author SHA1 Message Date
Typosaurus c163fdfd3b ticket #110 attempt 1
DevPlace CI / test (pull_request) Failing after 12s
2026-07-23 03:46:04 +00:00
4 changed files with 8 additions and 4 deletions
+5
View File
@@ -12,6 +12,7 @@ from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse, RedirectResponse from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from fastapi.exceptions import RequestValidationError from fastapi.exceptions import RequestValidationError
from starlette.middleware.gzip import GZipMiddleware
from devplacepy.config import ( from devplacepy.config import (
STATIC_DIR, STATIC_DIR,
STATIC_VERSION, STATIC_VERSION,
@@ -609,6 +610,10 @@ async def response_timing(request: Request, call_next):
response.headers["X-Response-Time"] = f"{(time.perf_counter() - start) * 1000:.1f}ms" response.headers["X-Response-Time"] = f"{(time.perf_counter() - start) * 1000:.1f}ms"
return response return response
app.add_middleware(GZipMiddleware, minimum_size=512, compresslevel=5)
_home_cache = TTLCache(ttl=int(os.environ.get("DEVPLACE_HOME_CACHE_TTL", "60")), max_size=4) _home_cache = TTLCache(ttl=int(os.environ.get("DEVPLACE_HOME_CACHE_TTL", "60")), max_size=4)
+1 -1
View File
@@ -14,7 +14,7 @@ import { PubSubClient } from "../PubSubClient.js";
const CHAT_CSS_ID = "chat-css"; const CHAT_CSS_ID = "chat-css";
const TYPING_THROTTLE_MS = 1500; const TYPING_THROTTLE_MS = 1500;
const TYPING_HIDE_MS = 4000; const TYPING_HIDE_MS = 4000;
const AUTO_SCROLL_MARGIN_PX = 100; const AUTO_SCROLL_MARGIN_PX = 0;
const STABILIZE_MAX_FRAMES = 300; const STABILIZE_MAX_FRAMES = 300;
const SEND_TIMEOUT_MS = 8000; const SEND_TIMEOUT_MS = 8000;
const MOBILE_BREAKPOINT_PX = 768; const MOBILE_BREAKPOINT_PX = 768;
@@ -11,7 +11,7 @@ How a request flows through middleware to a router, how the database layer is bu
## Middleware ## Middleware
Six HTTP middlewares run as a stack around every request, listed outermost first. `response_timing` is the outermost and `refresh_db_snapshot` the innermost. Compression is handled by nginx in production; the Python application does not compress responses itself. Seven HTTP middlewares run as a stack around every request, listed outermost first. `response_timing` is the outermost, `refresh_db_snapshot` the innermost, and a `GZipMiddleware` (responses over 512 bytes) wraps the whole stack on top:
| Middleware (outermost first) | Responsibility | | Middleware (outermost first) | Responsibility |
|------------|----------------| |------------|----------------|
+1 -2
View File
@@ -4,8 +4,7 @@ version = "1.0.0"
description = "DevPlace - The Developer Social Network" description = "DevPlace - The Developer Social Network"
requires-python = ">=3.12" requires-python = ">=3.12"
dependencies = [ dependencies = [
"fastapi>=0.110.0", "fastapi",
"starlette>=0.37.0",
"uvicorn[standard]", "uvicorn[standard]",
"jinja2", "jinja2",
"python-multipart", "python-multipart",