为什么资产:在Heroku上预编译速度如此之慢?
发布时间:2020-12-14 04:52:27 所属栏目:百科 来源:网络整理
导读:我的部署设置是使用Heroku预编译资产.我希望它们经过预编译,以便我可以将它们发送到CDN(通过 asset_sync),我希望在Heroku上完成,所以我的回购中没有任何已编译的资产.我使用 Heroku’s guide进行了设置,并且工作得非常好.我添加了 turbo-sprockets-rails3以
我的部署设置是使用Heroku预编译资产.我希望它们经过预编译,以便我可以将它们发送到CDN(通过
asset_sync),我希望在Heroku上完成,所以我的回购中没有任何已编译的资产.我使用
Heroku’s guide进行了设置,并且工作得非常好.我添加了
turbo-sprockets-rails3以提高速度.它一切正常,然后停止了;我无法弄清楚为什么.
现在当我部署(没有公共/资产)资产时:在Heroku上预编译Rake任务超时.为了看看它真正花了多长时间,我进入了一个shell(heroku run bash): ~ $time bundle exec rake assets:precompile AssetSync: YAML file found /app/config/asset_sync.yml settings will be merged into the configuration AssetSync: Syncing. Using: Directory Search of /app/public/assets AssetSync: Done. real 19m29.575s user 17m43.690s sys 0m28.480s 20分钟!但是当我在本地运行它(2011 iMac)时,它只有几分钟: $env RAILS_ENV=production time bundle exec rake assets:precompile --trace ** Invoke assets:precompile (first_time) ** Execute assets:precompile ~/.rbenv/versions/1.9.3-p327-perf/bin/ruby ~/.rbenv/versions/1.9.3-p327-perf/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace ** Invoke assets:precompile:all (first_time) ** Invoke assets:cache:clean (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment AssetSync: YAML file found ~/Code/Ruby/myproject-rails/config/asset_sync.yml settings will be merged into the configuration ** Execute assets:cache:clean ** Execute assets:precompile:all AssetSync: Syncing. Using: Directory Search of ~/Code/Ruby/myproject-rails/public/assets Uploading: assets/application-3a6de939348195e9610f1321df27837a.js Uploading: assets/application-3a6de939348195e9610f1321df27837a.js.gz Uploading: assets/jquery.min-959a5819c76e1508f5a8655c289c0de8.map Uploading: assets/jquery.min.map Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js Uploading: assets/rails_admin/rails_admin-76cfbf31a605916a55eee29464ca3e6d.js.gz AssetSync: Done. 179.92 real 19.29 user 3.98 sys 一周前我写了Heroku支持,几天后他们说他们会把它升级到他们的Ruby内置团队,但我还没有听到任何消息. Stack Overflow上的任何聪明人都有可能的解决方案吗? 解决方法
解决方案是使用tell Heroku来使用Ruby 1.9.3,就像我的本地机器一样.显然1.9.3在资产编译方面要比Heroku默认的1.9.2快得多.
要修复它,请确保您的Gemfile启动: source "https://rubygems.org" ruby "1.9.3" # ... 更多在Heroku docs on Ruby versions. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 高频头极化角调整+用什么本振的高频头
- ruby-on-rails – 在Amazon Linux AMI上安装capyabara-webk
- FusionCharts 2D帕累托图
- ios – 将自定义调色板添加到XCode Interface Builder
- ruby-on-rails – Rails创建方法创建重复项
- c# – 确定是否可以用float / double格式精确表示数字
- vue项目打包部署_nginx代理访问方法详解
- c# – 自定义身份验证的HttpModule如何与Windows身份验证交
- 14.5 Swift中unowned引用
- PostgreSql聚合函数二---聚合函数,分析函数和窗口函数