Increase the execution interval for the tracker stats importer

Aperta
#565 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@josecelano ci sta già lavorando.

Dal 24/4/2024.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Rust
Stelle
100
Fork
28
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di torrust/torrust-index

Tutte le issue di torrust/torrust-index

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.