Increase the execution interval for the tracker stats importer

Abierto
#565 0 comentarios 0 reacciones 1 asignado Ver en GitHub

@josecelano ya está trabajando en esto.

Desde el 24/4/2024.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Optimization

Relates to: https://github.com/torrust/torrust-demo/issues/1

There is a background task that imports torrent stats from the Tracker. The Tracker Statistics Importer checks every 100 milliseconds if there are torrents to import. It executes a SQL query to fetch torrents that have not been updated in the last hour:


	"torrent_id"	INTEGER NOT NULL,
	"tracker_url"	VARCHAR(256) NOT NULL,
	"seeders"	INTEGER NOT NULL DEFAULT 0,
	"leechers"	INTEGER NOT NULL DEFAULT 0,
	"updated_at"	TEXT DEFAULT 1000-01-01 00:00:00,
	FOREIGN KEY("torrent_id") REFERENCES "torrust_torrents"("torrent_id") ON DELETE CASCADE,
	UNIQUE("torrent_id","tracker_url"),
	PRIMARY KEY("torrent_id")
);

The field updated_at stores the last update date. You can configure the importer in the config file:

[tracker_statistics_importer]
torrent_info_update_interval = 3600

That configuration means the Index should try to update torrents at least every hour.

It seems querying the database every 100 milliseconds is overloading the demo server. Although it's a tiny instance, we should increase the interval. It could be a configuration option or even calculated manually in the future.

According to the data I've collected we could increase it from 100 milliseconds to 2000 milliseconds.

Lenguaje dominante
Rust
Estrellas
100
Forks
28
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

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 torrust/torrust-index

Todos los issues de torrust/torrust-index

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.