Skip to content

Commit

Permalink
fix(ruby): handle github rate limits when fetching ruby-build version
Browse files Browse the repository at this point in the history
Fixes #2004
  • Loading branch information
jdx committed May 1, 2024
1 parent 33f5473 commit 4a538a7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/plugins/core/ruby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ impl RubyPlugin {
}
fn update_ruby_build(&self) -> Result<()> {
let _lock = self.lock_build_tool();
if self.ruby_build_path().exists() {
let cur = self.ruby_build_version()?;
let latest = self.latest_ruby_build_version();
match (cur, latest) {
// ruby-build is up-to-date
(cur, Ok(latest)) if cur == latest => return Ok(()),
// ruby-build is not up-to-date
(_cur, Ok(_latest)) => {}
// error getting latest ruby-build version (usually github rate limit)
(_cur, Err(err)) => {
debug!("failed to get latest ruby-build version: {}", err);
return Ok(());
}
}
}
if self.ruby_build_path().exists()
&& self.ruby_build_version()? == self.latest_ruby_build_version()?
{
Expand Down

0 comments on commit 4a538a7

Please sign in to comment.