-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
Refactor AsyncTags #870
Refactor AsyncTags #870
Conversation
991fd5c
to
fb10d8b
Compare
asyncgit/src/asyncjob/mod.rs
Outdated
/// trait that defines an async task we can run on a threadpool | ||
pub trait AsyncJob: Send + Sync + Clone { | ||
pub trait AsyncJob: Send + Sync + Clone + Hash { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to adjust anything inside here (asyncjob/mod.rs
) all of this is implementation specific to the asynctags side and therefore should be limited to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but how to be able to send two different notifications than? mod.rs only returns 1.
Although, an option might be to write a wrapper around tags.rs that does the hashing. I'll give that a try.
Hi @mvaneijk sorry for making you digg into this without having checked deeper myself. turns out the asyncjob abstraction was not good ending yet to allow you to do this in a nice way. I pushed a few additions now:
I think this should provide everything you need. |
Hi @extrawurst, thanks for the effort. No worries, this is a good exercise for me to get acquainted with Rust. Regarding the 'simple' wrapper. I will think of something. But I guess I probably end up creating another AsyncSingleJob for this wrapper/awaiter, because it can only compare the last_job hash after the tagsjob has finished. And the wrapper cannot be blocking while awaiting the result, hence should be an AsyncJob. |
hi @extrawurst, I don't know how to perform the hashcheck without changing the AsyncSingleJob code. Situation
I think there are 2 options
Both need changing of the AsyncSingleJob code, what do you think? ~ edit: after some rethink, I guess option 1 makes the most sense. Probably a "send_notification" function as part of the AsyncJob trait that gets access to |
0bd9356
to
0d8bb5d
Compare
The eagle has landed I guess I've seen the light :) @extrawurst, can you review it? |
haha that sounds great! ❤️
I will, as soon as I am back from my vacation! |
Good catch, I will look into it. |
@mvaneijk are you still on this? |
I will try again today and let you know if I give up after that. I have a hard time debugging the issue, |
@extrawurst feel free to assign someone else to it. Maybe part or my PR can be reused, I feel that it is something small but I will probably have time again in the Christmas Holidays. |
putting into draft until picked up again |
This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
This has been merged a while ago in 2022 =D, thx @guzzit |
Hi @extrawurst, I thought it would be a good idea to push my preliminary solution because I have some questions.
I looked at the other 2 implementations of AsyncSingleJob, do you think the solution is the right direction?Why is there a 3 second timer in the current get-tag code? It seems interlinked with the async code, but it doesn't appear in the AsyncSingleJob struct. Is it still needed?It seems there is a regression that removes the commit messages in the tags list, is that on purpose? does it need fixing? can I fix it directly in this PR? (introduced with 0f89693) - ah, it seems an issue with tui or crossterm (maybe broken API?)Implementation
Review
@extrawurst, can you perform a review and give me some guidance on what parts to improve?
Documentation
This Pull Request fixes/closes #757.
It changes the following:
(Fix regression: missing commit messages in TagList?)I followed the checklist:
make check
without errors