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

feat: configurable plugin repo last check time #957

Merged
merged 4 commits into from Jun 2, 2021

Conversation

NeoHsu
Copy link
Contributor

@NeoHsu NeoHsu commented May 26, 2021

Summary

Add update plugins repo function to asdf plugin-update command that can be get latest asdf plugins list

Hi everyone,
I tried to update the asdf plugins today,
but I didn't get latest plugins list.

I can't find a way to update asdf plugin list,
so I implement this function in plugin update command.

I think about plugin update command for user flow,
When user want to update plugin,
they maybe want to get latest plugin list,
so I add trigger function on plugin update command.

I hope to help this project to be better.

Thanks.

@NeoHsu NeoHsu requested a review from a team as a code owner May 26, 2021 10:37
@jthegedus
Copy link
Contributor

jthegedus commented May 26, 2021

Hi @NeoHsu thanks for proposing this change, I think we do need to communicate this better. I have been thinking about making a change like this. Some background on this:

Your proposal splits the functionality of the plugin repo update into two:

  1. always check when running asdf plugin update
  2. use the time-based check in asdf plugin list all and asdf plugin add

I think there is a more simple and user-configurable solution that gives us both results without the split in functionality:

  • use find -mmin instead of find -mtime. This changes our check resolution to minutes from days.
  • set the -mmin time value from a config value in .asdfrc. This lets user's customise the frequency of the update check. Default to 60.
  • no need extract new function as we can then just use initialize_or_update_repository everywhere
  • no need to print the updates out as people can expect and know when they are on the latest

What do you think of this suggestion?

@NeoHsu
Copy link
Contributor Author

NeoHsu commented May 26, 2021

That's cool !!
I didn't notice this command find -mtime.

But I think print plugins updates is very important.
The asdf be designed very easy to build new plugin.
Many develpors can build plugin into asdf by self.
I will want to look which new plugin have be join to asdf.

Thanks for getting back to me.

@NeoHsu NeoHsu force-pushed the feat/update_plugins_repo branch 2 times, most recently from 924e64b to b658e9d Compare May 26, 2021 16:09
@NeoHsu
Copy link
Contributor Author

NeoHsu commented May 26, 2021

Hi @jthegedus ,
I modify this PR to follow your suggestion,
thanks

@jthegedus jthegedus changed the title Feat: add update plugins repo flow feat: configurable plugin repo last check time May 26, 2021
lib/utils.bash Outdated Show resolved Hide resolved
@jthegedus
Copy link
Contributor

This is looking like a good improvement @NeoHsu

@Stratus3D do you have thoughts here? I am not sure how portable the -mmins option is. I can't find much online.

@NeoHsu
Copy link
Contributor Author

NeoHsu commented May 27, 2021

Hi @jthegedus, I'm finish now,
Thanks for your suggestions.

@jthegedus
Copy link
Contributor

jthegedus commented May 30, 2021

This change works great 🎉

I'm going to write a couple of tests for this:

  1. for the plugin_repository_last_check_duration = 0 case. Should expect sync.
  2. for the default case. Should expect no sync.

Copy link
Contributor

@jthegedus jthegedus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me now. Thanks again

@Stratus3D
Copy link
Member

This is looking like a good improvement @NeoHsu

@Stratus3D do you have thoughts here? I am not sure how portable the -mmins option is. I can't find much online.

Sorry I missed your comment. I am not sure either, but I also don't see folks online reporting any issues with the flag not being supported, so I guess we will see how it goes.

I agree this is a nice improvement. Is there a way to turn off checking completely? e.g. is there another configuration option for that? Or can I somehow set this last check time to infinity?

@jthegedus
Copy link
Contributor

Is there a way to turn off checking completely? e.g. is there another configuration option for that? Or can I somehow set this last check time to infinity?

Good questions. I would prefer a solution that does not require another config option. I believe the numeric value for mmin is represented by gnulib timespec which has a max value of 999999999 which equates to 1902 years. We could introduce a special val like plugin_repository_last_check_duration = never.

@Stratus3D
Copy link
Member

Is there a way to turn off checking completely? e.g. is there another configuration option for that? Or can I somehow set this last check time to infinity?

Good questions. I would prefer a solution that does not require another config option. I believe the numeric value for mmin is represented by gnulib timespec which has a max value of 999999999 which equates to 1902 years. We could introduce a special val like plugin_repository_last_check_duration = never.

I would like something like plugin_repository_last_check_duration = never that tells asdf not to make any unnecessary network connections (I like to work offline so checking for updates is something I'd like to disable completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants