我有一个相对较大的系统运行 Rails 和 TinyTds(使用 FreeTds 的 SQLServer 数据库适配器)。问题是我每天收到大约 200 封电子邮件,说我的请求超时或死锁。
[Exception] application#index (ActionView::Template::Error) "TinyTds::Error: Adaptive Server connection timed out: EXEC sp_executesql
它们总是发生在不同的动作上。
A ActiveRecord::DeadlockVictim occurred in transportes#importacao:
TinyTds::Error: Transaction (Process ID 276) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
我不知道为什么它会超时这么多,并且已经在这些电子邮件中苦苦挣扎了将近 2 个月。我已经尝试更新 gem 版本,FreeTds 的 linux 二进制文件,但没有任何帮助。
目前使用 Ruby 1.9.3-p484、Rails 3.2.16 和 TinyTds 0.6.2
谁能给我一些关于如何解决这个问题的见解?