草庐IT

connection_adapters

全部标签

ruby-on-rails - rails : switch connection on each request but keep a connection pool

在我们的Rails应用程序中,我们需要根据请求的子域使用不同的数据库(每个国家/地区使用不同的数据库)。现在我们正在做类似于thisquestion中推荐的事情.也就是说,在每个请求上调用ActiveRecord::Base.establish_connection。但是itseemsActiveRecord::Base.establish_connection删除当前连接池并在每次调用时建立一个新连接。我做了这个快速基准测试,看看每次调用establish_connection和已经建立连接之间是否有任何显着差异:require'benchmark/ips'$config=Rails

ruby - 请安装 postgresql 适配器 : `gem install activerecord-postgresql-adapter`

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:HowtohandleRubyonRailserror:“Pleaseinstallthepostgresqladapter:`geminstallactiverecord-postgresql-adapter'”我正在尝试让Redmine与postgres一起工作。在我的日志中,我不断看到。Pleaseinstallthepostgresqladapter:`geminstallactiverecord-postgresql-adapter`在谷歌搜索之后,每个人都说你需要做geminstallpg。但是当

ruby-on-rails - 即使线程池中只有一个线程,也会发生并发吗?

我正在使用Rails5和Ruby2.4。我如何弄清楚,或者您可以通过查看下面的内容来判断是否有多个线程同时运行?pool=Concurrent::FixedThreadPool.new(1)promises=links.mapdo|link|Concurrent::Promise.execute(executor:pool)doresult=process_link(link)ifresultifresult.kind_of?(Array)result.eachdo|my_obj|my_obj.update_attributes({:a=>a})records_processed=re

ruby-on-rails - headless gem : webkit_server: cannot connect to X server

我在使用Headlessgem、Xvfb和我们的ci服务器运行capybara-webkit时遇到了一些问题。我们使用此设置对我们的RubyonRails3.2应用程序进行自动集成测试和javascript测试。在测试期间它提示说webkit_server:cannotconnecttoXserver但是当我psaux|grepXvfbdeploy16020.00.1616961912pts/2S+Jul100:00/usr/bin/Xvfb:99-screen01280x1024x24-ac我看到Xvfb正在运行。如果我使用--trace运行测试,它也只显示上面的错误日志,我无法调试

ruby-on-rails - sunspot_rails gem - "Errno::ECONNREFUSED (Connection refused - connect (2)) "

我使用gemsunspot_railshttps://github.com/outoftime/sunspot我按照http://railscasts.com/episodes/278-search-with-sunspot上的说明做了一切,但出现错误Errno::ECONNREFUSED(Connectionrefused-connect(2)):app/controllers/books_controller.rb:7:in`index'来自books_controller.rb的代码defindex@search=Book.searchdofulltextparams[:sear

ruby-on-rails - Rails Resque 工作人员因 PGError : server closed the connection unexpectedly 失败

我在Ubuntu9.10、Rails2.3.4、ruby-ee2010.01、PostgreSQL8.4.2上有站点运行rails应用程序和在生产模式下运行的resqueworkerWorkers不断报错:PGError:serverclosedtheconnectionunexpectedly.我最好的猜测是masterresque进程建立了与db的连接(例如,authlogic在使用User.acts_as_authentic时会这样做),同时加载Rails应用程序类,并且该连接在fork()ed进程(退出时?)中被破坏,所以下一个fork的child会得到一种splinter的全

ruby - Heroku Rails 4 无法连接到服务器 : connection refused

使用postgres。一直推不开。没有任何运气尝试过:config.assets.initialize_on_precompile=false----->PreparingappforRailsassetpipelineRunning:rakeassets:precompilerakeaborted!couldnotconnecttoserver:ConnectionrefusedIstheserverrunningonhost"127.0.0.1"andacceptingTCP/IPconnectionsonport5432? 最佳答案

ruby-on-rails - OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A

下面的代码会产生以下错误:OpenSSL::SSL::SSLError:SSL_connectSYSCALLreturned=5errno=0state=SSLv3readserverhelloArequire'net/https'uri=URI.parse("https://.com")http=Net::HTTP.new(uri.host,uri.port)http.use_ssl=truehttp.ssl_version='SSLv3'http.get(uri.request_uri)知道为什么吗?我尝试了所有其他问题中提到的所有内容,仍然没有运气。Ruby1.9.3p484(2

ruby-on-rails - rake Assets :precompile attempting to connect to database

我正在尝试调试为什么我的应用程序在我运行rakeassets:precompile--trace时尝试连接到我的数据库。我可能在堆栈跟踪中遗漏了一些东西...有人看到相关行吗?DEPRECATIONWARNING:TheInstanceMethodsmoduleinsideActiveSupport::Concernwillbenolongerincludedautomatically.PleasedefineinstancemethodsdirectlyinActionController::Baseinstead.(calledfromat/Users/Kyle/Desktop/s

ruby-on-rails - 使用 `ActiveRecord with_connection do` 和 ActionController::Live 时出现线程错误

主要编辑:自从最初发现此问题后,我已将其缩减为以下内容。我认为现在这是对问题的略微更精确的描述。因此,对OP的评论可能并不完全相关。编辑在rails/puma项目中发布的轻微修改版本:https://github.com/rails/rails/issues/21209,https://github.com/puma/puma/issues/758编辑现在用OSX和Rainbows复制总结:当使用Puma并运行长时间运行的连接时,我一直收到与跨线程的ActiveRecord连接相关的错误。这在消息中表现出来,例如消息类型0x##空闲时从服务器到达和锁定(崩溃)的服务器。设置:Ubunt