-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
BugIncorrect BehaviorIncorrect Behavior
Description
Relates to: #419
I've been checking the logs of the live demo. It's failing because the tracker token is not valid:
2023-12-26T11:00:35.187361844+00:00 [torrust_index::tracker::statistics_importer][INFO] Updating torrent 1 ...
2023-12-26T11:00:35.233911132+00:00 [torrust_index::tracker::service][ERROR] Failed to parse torrent info from tracker response. Body: Unhandled rejection: Err { reason: "token not valid" }
2023-12-26T11:00:35.242595113+00:00 [torrust_index::tracker::statistics_importer][ERROR] Error updating torrent tracker stats for torrent with id 1: TorrentNotFoundThere are two issues:
- Invalid token:
Token not valid - Wrong logged error:
TorrentNotFound
Wrong logged error
The second issue is that all tracker API errors are written into the log as TorrentNotFound errors. That was already documented with a code-review comment in the code:
pub async fn import_all_torrents_statistics(&self) -> Result<(), database::Error> {
info!("Importing torrents statistics from tracker ...");
let torrents = self.database.get_all_torrents_compact().await?;
for torrent in torrents {
info!("Updating torrent {} ...", torrent.torrent_id);
let ret = self.import_torrent_statistics(torrent.torrent_id, &torrent.info_hash).await;
// code-review: should we treat differently for each case?. The
// tracker API could be temporarily offline, or there could be a
// tracker misconfiguration.
//
// This is the log when the torrent is not found in the tracker:
//
// ```
// 2023-05-09T13:31:24.497465723+00:00 [torrust_index::tracker::statistics_importer][ERROR] Error updating torrent tracker stats for torrent with id 140: TorrentNotFound
// ```
if let Some(err) = ret.err() {
let message = format!(
"Error updating torrent tracker stats for torrent with id {}: {:?}",
torrent.torrent_id, err
);
error!("{}", message);
}
}
Ok(())
}We should log the right reason.
Metadata
Metadata
Assignees
Labels
BugIncorrect BehaviorIncorrect Behavior
Type
Projects
Status
No status