Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Performance: every page view reads, decodes and rewrites the whole view counter under one lock

Abierto
#677 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@guidol-ive ya está trabajando en esto.

Desde el 28/10/2026.

  • #678 de @guidol-ive — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
php

Línea de trabajo

Read base.php at hypha_incrementStats() and hypha_getStats(), then trace how flushDigest() consumes the counter. Check the existing handling of data/hypha.stats and the proposed data/hypha.stats.log behavior, including period boundaries and cleanup. Done means views append short period timestamps and digest reads add and discard reported periods; pull request #678 is already open against this issue.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Impact: Medium Level: Easy Type: Bug Value: Visitors

Part of #411.

Problem

Every page view by a visitor runs hypha_incrementStats() (base.php), which:

  1. takes an exclusive lock on data/hypha.stats;
  2. reads and decodes the whole JSON file;
  3. adds one;
  4. writes the whole file back through a temporary file and rename().

All views of the site wait for each other on that one lock, and the file grows with every digest period. Under load on a bind mount (Docker Desktop on macOS), the rename() also briefly hides the file from a parallel fopen(), which then fails with a 500 (Cannot lock file data/hypha.stats, open failed).

The count is only read once per digest period, by flushDigest() through hypha_getStats().

Proposal

  • Append one short line (the timestamp of the period) per view to data/hypha.stats.log, with FILE_APPEND | LOCK_EX: the lock lasts microseconds, and nothing is read.
  • hypha_getStats() adds the lines of the period to the old count in hypha.stats, and then drops the lines of periods that have been reported, so the log stays small.
Lenguaje dominante
JavaScript
Estrellas
5
Forks
9
Merge medio
19 h 10 min
PR fusionados (30 d)
12

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PlanBCode/hypha

Todos los issues de PlanBCode/hypha

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.