ani-cli icon indicating copy to clipboard operation
ani-cli copied to clipboard

The number of anime shown from history is inconsistent.

Open PhosCity opened this issue 2 years ago • 2 comments

Metadata (please complete the following information) Version: 3.4.1 OS: Arch Linux Shell: zsh

Describe the bug When I run ani-cli -c, the number of anime shown changes in each run. See screenshot.

Steps To Reproduce

  1. Have a bunch of animes in your history file.
  2. Run ani-cli -c
  3. Quit out by typing q after observing the number of anime shown.
  4. Run ani-cli -c again.

Expected behavior The number of anime shown should be consistent

Screenshots Screenshot_2022-09-23-15-12-03_1366x768

PhosCity avatar Sep 23 '22 09:09 PhosCity

This is expected behaviour. The reason is that when you parse your history file, for each line the script checks if it is valid . Since there's a chance of new episodes being released, the script always checks for its validity. This involves web requests, which involve a lot of waiting (for the servers' answer). To avoid minute long waits, the script processes all entries at the same time. Because of this and the nature of the internet the answers come in an unpredictable order and are printed somewhat differently each time.

Since it was not critical, the output is not ordered by anything. If you explain why there's a good reason to be consistent we can talk about having a sorted output

Derisis13 avatar Sep 23 '22 13:09 Derisis13

I apologize, I probably wasn't clear. The issue I'm raising is not that the output is not sorted. It's that the number of the output is not consistent. If you look at the screenshot, the first time the output showed 14 animes but the second time I ran it immediately, the output showed 6 animes.

PhosCity avatar Sep 23 '22 14:09 PhosCity

Oh I see... Can you tell us how to reproduce this state? I have never came across this before.

Derisis13 avatar Sep 25 '22 01:09 Derisis13

I tested and it appears it happens if I re run anicli immediately after exiting it. If I wait like 10 seconds, the issue does not occur. It also originally occurred when I watched an episode and then immediately ran anicli to watch another anime. So at this point I think it's only worth fixing if it's an easy fix because I can wait a few seconds to watch another anime.

PhosCity avatar Sep 25 '22 02:09 PhosCity

@PhosCity does this behaviour persist? Have you figured out anything extra?

Derisis13 avatar Nov 08 '22 23:11 Derisis13

The behavior definitely persists. This may or may not be significant but I think if the number of animes in your history file is more, this behavior occurs more frequently. Since I started using ani-cli, I had never cleaned history file ever and the number of animes I had in my history file was 42 (most of them already completed shows). When I removed animes that I had already watched, this behavior reduced but not fully gone.

So while I cannot say that the cause is a lot of items in history, cleaning it has definitely helped a little.

PhosCity avatar Nov 10 '22 10:11 PhosCity

I'm closing this because v4 is a full rewrite, including the history. Feel free to reopen it if we reintroduce the same issue.

Derisis13 avatar Jan 07 '23 13:01 Derisis13