-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Question] Understanding of task cancellation #15
Comments
Previously the loop would wait for the next yield but instead we can just step forward immediately when cancelling. See #15
Ah no that is not intended behaviour 😅 I've pushed a fix and it should be working as you'd expect now |
Hmm, started seeing an exception |
Agree, I'm facing it too Error executing vim.schedule lua callback: ...nvim/site/pack/packer/start/nvim-nio/lua/nio/control.lua:133: Future already set
stack traceback:
[C]: in function 'error'
...nvim/site/pack/packer/start/nvim-nio/lua/nio/control.lua:133: in function 'set_error'
...e/nvim/site/pack/packer/start/nvim-nio/lua/nio/tasks.lua:93: in function 'close_task'
...e/nvim/site/pack/packer/start/nvim-nio/lua/nio/tasks.lua:111: in function 'cb'
...e/nvim/site/pack/packer/start/nvim-nio/lua/nio/tasks.lua:185: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue |
I'm not seeing the same issue myself but I've pushed a change that I think should fix it. If not, could someone provide a simple reproduction if possible? |
I have just checked, bug is still here. |
If a callback returns after a task is already cancelled, we should gracefully handle it by not attempting to set the result of the task since it is already set. See #15
Ah yes I was able to reproduce with that thank you. I've pushed another fix which should now address the issue |
fixed problem with "Future already set" for me nvim-neotest/neotest#402 |
Looks like fixed! Thanks! |
I am trying to close a (potentially long running) process, if it's task is cancelled for some reason (e.g. timeout).
Here is a minimal example without processes:
My expectation would be, that after 1 second, both 'cancel the handle!' and 'canceled or success' (caused by the task cancellation) would be printed.
However, the callback function is only called after the full 5 seconds.
Is this the intended behavior? If yes, what would be the proper way to do this?
The text was updated successfully, but these errors were encountered: