部署到heroku时清理bundler缓存

时间:2022-05-29 00:14:41

Whenever I'm deploying to Heroku (Ruby on Rails app using the heroku_san gem) it says the following:

每当我使用heroku_san gem部署到Heroku(Ruby on Rails应用程序)时,它会说:

Cleaning up the bundler cache.
Would have removed sitemap_generator (2.0.1.pre1)
Would have removed newrelic_rpm (3.5.5.38)
Would have removed httparty (0.10.0)
Would have removed thor (0.16.0)
Would have removed ckeditor (3.7.1)
Would have removed fog (1.8.0)
Would have removed rake (0.9.2.2)
Would have removed dalli (2.6.0)

(or any other old gem I might have from previous deployments) How can I clean the bundler cache in the Heroku app? I tried to run:

(或者我以前部署中可能拥有的任何其他旧gem)如何清除Heroku应用程序中的bundler缓存?我试着跑:

heroku run bundle clean --force

but it did not help.

但它没有帮助。

Can anyone tell me how to clean the bundler cache in Heroku? Or if I should ignore this message?

谁能告诉我如何在Heroku中清理捆绑缓存?或者如果我应该忽略这个消息?

2 个解决方案

#1


22  

This is due to a recently-introduced change in Bundler. We (Heroku) need to track down why it thinks it is running in --dry-run mode and fix it.

这是由于Bundler最近引入的变化。我们(Heroku)需要追踪它认为它在--dry-run模式下运行的原因并修复它。

In the meantime, this is not harmful and shouldn't cause any issues. Unfortunately, there's no way to clear your cache manually if you're worried about it.

与此同时,这不是有害的,不应该引起任何问题。不幸的是,如果您担心它,就无法手动清除缓存。

#2


5  

I also get this on every Heroku app I've ever deployed and have yet to experience problems.

我也在我部署的每个Heroku应用程序上得到了这个,并且还没有遇到问题。

Here's why I think you don't have to worry about it:

这就是为什么我认为你不必担心它:

  • Having a bunch of stored gems on their server shouldn't slow down your app. Heck, even if you threw in a bunch of gems you didn't need into your Gemfile, the noticeable performance hits are likely to be to your app's initial launch time and subsequent memory use. And if those gems aren't in your Gemfile, the performance hit to your app should be nil.
  • 在他们的服务器上拥有一堆存储的宝石不应该减慢您的应用程序。哎呀,即使你把一堆你不需要的宝石扔进你的Gemfile,明显的性能命中可能是你的应用程序的初始启动时间和随后的内存使用。如果这些宝石不在您的Gemfile中,那么对您的应用程序的性能影响应为零。
  • While Heroku has a soft limit of 100MB for slugs on a free account, my own anecdotal evidence suggests that this does not include gems you've removed from your Gemfile (which makes sense if the wild speculation below is correct).
  • 虽然Heroku在免费帐户上有一个100MB的软限制,但我自己的轶事证据表明,这不包括你从Gemfile中删除的宝石(如果下面的疯狂推测是正确的,这是有道理的)。

And here's wild speculation as to why Heroku isn't cleaning the bundler cache:

这里有一个疯狂的猜测,为什么Heroku没有清理Bundler缓存:

Memory is more expensive than hard drive space, so while most gems might take up a trivial amount of space on a hard drive, they can add up if a ton of gems have to be loaded into memory. However, if a gem isn't in your Gemfile, it won't be in memory. And it's very likely more expensive to remove (and possibly later re-download) a gem than it is to keep it stored on the drive, just in case you later change your mind and want to re-add it to your Gemfile.

内存比硬盘驱动器空间更昂贵,因此虽然大多数宝石可能会占用硬盘驱动器上的大量空间,但如果必须将大量宝石加载到内存中,它们可能会相加。但是,如果gem不在您的Gemfile中,它将不在内存中。删除(以及可能以后重新下载)gem的成本可能比将它保存在驱动器上更昂贵,以防万一你以后改变主意并想重新添加到你的Gemfile中。

#1


22  

This is due to a recently-introduced change in Bundler. We (Heroku) need to track down why it thinks it is running in --dry-run mode and fix it.

这是由于Bundler最近引入的变化。我们(Heroku)需要追踪它认为它在--dry-run模式下运行的原因并修复它。

In the meantime, this is not harmful and shouldn't cause any issues. Unfortunately, there's no way to clear your cache manually if you're worried about it.

与此同时,这不是有害的,不应该引起任何问题。不幸的是,如果您担心它,就无法手动清除缓存。

#2


5  

I also get this on every Heroku app I've ever deployed and have yet to experience problems.

我也在我部署的每个Heroku应用程序上得到了这个,并且还没有遇到问题。

Here's why I think you don't have to worry about it:

这就是为什么我认为你不必担心它:

  • Having a bunch of stored gems on their server shouldn't slow down your app. Heck, even if you threw in a bunch of gems you didn't need into your Gemfile, the noticeable performance hits are likely to be to your app's initial launch time and subsequent memory use. And if those gems aren't in your Gemfile, the performance hit to your app should be nil.
  • 在他们的服务器上拥有一堆存储的宝石不应该减慢您的应用程序。哎呀,即使你把一堆你不需要的宝石扔进你的Gemfile,明显的性能命中可能是你的应用程序的初始启动时间和随后的内存使用。如果这些宝石不在您的Gemfile中,那么对您的应用程序的性能影响应为零。
  • While Heroku has a soft limit of 100MB for slugs on a free account, my own anecdotal evidence suggests that this does not include gems you've removed from your Gemfile (which makes sense if the wild speculation below is correct).
  • 虽然Heroku在免费帐户上有一个100MB的软限制,但我自己的轶事证据表明,这不包括你从Gemfile中删除的宝石(如果下面的疯狂推测是正确的,这是有道理的)。

And here's wild speculation as to why Heroku isn't cleaning the bundler cache:

这里有一个疯狂的猜测,为什么Heroku没有清理Bundler缓存:

Memory is more expensive than hard drive space, so while most gems might take up a trivial amount of space on a hard drive, they can add up if a ton of gems have to be loaded into memory. However, if a gem isn't in your Gemfile, it won't be in memory. And it's very likely more expensive to remove (and possibly later re-download) a gem than it is to keep it stored on the drive, just in case you later change your mind and want to re-add it to your Gemfile.

内存比硬盘驱动器空间更昂贵,因此虽然大多数宝石可能会占用硬盘驱动器上的大量空间,但如果必须将大量宝石加载到内存中,它们可能会相加。但是,如果gem不在您的Gemfile中,它将不在内存中。删除(以及可能以后重新下载)gem的成本可能比将它保存在驱动器上更昂贵,以防万一你以后改变主意并想重新添加到你的Gemfile中。