chore: add locust files + testing setup
This commit is contained in:
@@ -22,7 +22,7 @@ _client = redis.Redis.from_url(settings.PLACE_REDIS_URL)
|
||||
|
||||
|
||||
def _canvas_key(event_path: str) -> str:
|
||||
return f"place:canvas:{event_path}"
|
||||
return f"place:{event_path}:canvas"
|
||||
|
||||
|
||||
def read_canvas(event_path: str, width: int, height: int) -> bytes:
|
||||
@@ -49,9 +49,11 @@ def rebuild_canvas_from_history(event, width: int, height: int) -> int:
|
||||
"""
|
||||
grid = bytearray(width * height)
|
||||
count = 0
|
||||
placements = PixelPlacement.objects.filter(event=event).order_by(
|
||||
"placed_at"
|
||||
).values_list("x", "y", "color_index")
|
||||
placements = (
|
||||
PixelPlacement.objects.filter(event=event)
|
||||
.order_by("placed_at")
|
||||
.values_list("x", "y", "color_index")
|
||||
)
|
||||
for x, y, color_index in placements.iterator():
|
||||
if x >= width or y >= height:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user