Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#677 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@guidol-ive がすでに取り組んでいます。

2026年10月28日 から。

  • #678 @guidol-ive による — オープン

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
JavaScript
スター
5
フォーク
9
平均マージ
19時間 10分
マージ済み PR(30日)
12

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PlanBCode/hypha のほかの issue

PlanBCode/hypha の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。