Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The card cannot be updated, when there are more than 5 noteID annotations in the .md file #121

Closed
Colbyzn opened this issue Nov 22, 2023 · 7 comments · Fixed by #132
Closed
Labels
bug Something isn't working

Comments

@Colbyzn
Copy link

Colbyzn commented Nov 22, 2023

Thanks for you, this tool is very useful!

Problem Description:

When I add a noteID annotation to a card in the .md document, everything goes smoothly until I add a noteID annotation to the sixth card, which does not get updated. Additionally, a prompt "Deck not sent: request to http://127.0.0.1:8765/failed, reason: connect ECONNREFUSED 127.0.0.1:8765" pops up in the bottom right corner of vscode.

Content of the .md document:
image

@jasonwilliams jasonwilliams added the bug Something isn't working label Nov 22, 2023
@JeffreyAnimal
Copy link

Thanks for the Tool, indeed very useful. ❤️

Is anyone currently working on this Issue?
On my tests with no initial notecardId after the 6th card all the Id's are null.
So maybe there is a Issue with the Id allocation?
Or could it be related to an Update of the Anki-Connector Plugin?

@jasonwilliams
Copy link
Owner

Thanks @JeffreyAnimal
There’s currently no one working on this, I haven’t had much time but am always open to PRs or contributions.

@JeffreyAnimal
Copy link

After a bit of Testing it showed that the reason is not the request itself sent to the Anki Connector.

Maybe the Connector has a request Limit after whitch the connection is refused and returning "connect ECONNREFUSED 127.0.0.1:8765".
Because sometimes on Debugging, the Error appears, but the 6th Card is still Updated.

A Idea would be to check if a Card value has been changed and only Update the Cards with changes. The Issue would still be, that only 5 or so Cards can be Updated simulaneously.

Another Idea would be to send only a limited amount of Update request and only send more, when the first few have been answered.

@ccammack
Copy link
Contributor

I tried a deck of 1000 cards with the new release and could not reproduce this.

$ cat ./issue-121.sh 
#!/bin/sh
echo "# test"
i=0
while [ $i -lt $1 ]
do
  echo "## Front $i"
  echo "Back $i"
  i=$((i + 1))
done

$ chmod +x ./issue-121.sh

$ ./issue-121.sh 1000 > issue-121.md 

$ head -9 issue-121.md
# test
## Front 0
Back 0
## Front 1
Back 1
## Front 2
Back 2
## Front 3
Back 3

$ tail -9 issue-121.md
Back 995
## Front 996
Back 996
## Front 997
Back 997
## Front 998
Back 998
## Front 999
Back 999

I used "Anki: Send to own deck" to generate the IDs and send the deck to Anki, which took several minutes, but everything seemed to arrive okay.

$ head -9 issue-121.md
# test
## Front 0

<!-- notecardId: 1718073001824 -->
Back 0
## Front 1

<!-- notecardId: 1718073001829 -->
Back 1

$ tail -9 issue-121.md
Back 997
## Front 998

<!-- notecardId: 1718073009837 -->
Back 998
## Front 999

<!-- notecardId: 1718073009844 -->
Back 999

Screenshot from 2024-06-10 22-47-38

I don't think the card count itself is causing the problem; there must something else going on.

@JeffreyAnimal
Copy link

@ccammack The Issue isn't sending a new Deck to the Anki but Updating a existing Deck where the notecardId has already been set.

@ccammack
Copy link
Contributor

Thanks, @JeffreyAnimal, I got it to happen about 2 minutes after starting the sync.

$ sed -i "s/## Front/## Front (changed)/g" issue-121.md
$ sed -i "s/Back/Back (changed)/g" issue-121.md

@jasonwilliams
Copy link
Owner

This has been fixed and released in https://github.com/jasonwilliams/anki/releases/tag/v.1.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants