From 126e90084ebf6df0f664a3c5a038099dde195c86 Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Sat, 6 Apr 2024 08:43:15 -0500 Subject: [PATCH] 0.0.4 - fix simulated load --- CHANGELOG.md | 4 ++++ htmx_patterns/__about__.py | 2 +- htmx_patterns/infinite/router.py | 3 ++- justfile | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f0ad8..9178848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # HTMX-PATTERNS CHANGELOG +## 0.0.4 + +* fix simulated load need asyncio.sleep + ## 0.0.3 * fix docker `ENV=prod` diff --git a/htmx_patterns/__about__.py b/htmx_patterns/__about__.py index 4f7f2ea..a2ba126 100644 --- a/htmx_patterns/__about__.py +++ b/htmx_patterns/__about__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2024-present Waylon S. Walker # # SPDX-License-Identifier: MIT -__version__ = "0.0.3" +__version__ = "0.0.4" diff --git a/htmx_patterns/infinite/router.py b/htmx_patterns/infinite/router.py index c9ee302..030debc 100644 --- a/htmx_patterns/infinite/router.py +++ b/htmx_patterns/infinite/router.py @@ -1,3 +1,4 @@ +import asyncio import time from fastapi import APIRouter @@ -22,7 +23,7 @@ async def infinite(request: Request, page: int = 1, n: int = 10): persons = [PersonFactory.build() for _ in range(n)] if request.state.prefers_partial: - time.sleep(1) + await asyncio.sleep(0.5) return config.templates.TemplateResponse( "infinite/persons_partial.html", { diff --git a/justfile b/justfile index 5a88655..447a0dc 100644 --- a/justfile +++ b/justfile @@ -2,8 +2,9 @@ default: @just --list build-image: - podman build -t docker.io/waylonwalker/htmx-patterns-waylonwalker-com:0.0.3 . + podman build -t docker.io/waylonwalker/htmx-patterns-waylonwalker-com:$(hatch version) . push-image: - podman push docker.io/waylonwalker/htmx-patterns-waylonwalker-com:0.0.3 + podman push docker.io/waylonwalker/htmx-patterns-waylonwalker-com:$(hatch version) +