Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Python 3.13 #864

Open
wants to merge 14 commits into
base: 0.12
Choose a base branch
from
Prev Previous commit
Next Next commit
Update server.py
  • Loading branch information
Dreamsorcerer committed Jun 13, 2024
commit 9de7517c85983099251bb1797cbf5de2d8c48f5d
10 changes: 5 additions & 5 deletions tests/performance/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ async def close(self, *_):
await self.cache.close()


cache = web.AppKey("cache", CacheManager)
cache_key = web.AppKey("cache", CacheManager)


async def handler_get(req):
try:
data = await req.app[cache].get("testkey")
data = await req.app[cache_key].get("testkey")
if data:
return web.Response(text=data)
except asyncio.TimeoutError:
return web.Response(status=404)

data = str(uuid.uuid4())
await req.app[cache].set("testkey", data)
await req.app[cache_key].set("testkey", data)
return web.Response(text=str(data))


def run_server(backend: str) -> None:
app = web.Application()
app[cache] = CacheManager(backend)
app.on_shutdown.append(app[cache].close)
app[cache_key] = CacheManager(backend)
app.on_shutdown.append(app[cache_key].close)
app.router.add_route("GET", "/", handler_get)
web.run_app(app)
Loading