Skip to content

Commit 00316d0

Browse files
jeremyfTom Johnson
authored and
Tom Johnson
committed
Attempting to quash SQLite3::BusyException
On occasion, our specs encounter a `SQLite3::BusyException` exception. This commit, based on some Google-fu (actually DuckDuckGo-ing but that's not yet in our vernacular), I found a few references that involve increasing the `RAILS_MAX_THREADS` environment variable and/or increasing the database timeout. In CircleCI, for SHA 600753e and rspec seed 3048, we encountered the problem. I don't assume that we can duplicate this behavior with that configuration. References * https://stackoverflow.com/questions/7154664/ruby-sqlite3busyexception-database-is-locked
1 parent f9b75f2 commit 00316d0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
environment:
2121
RAILS_VERSION: << parameters.rails_version >>
2222
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
23+
RAILS_MAX_THREADS: 50
2324
steps:
2425
- samvera/cached_checkout
2526
- samvera/bundle_for_gem:

.regen

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5
1+
6

tasks/hyrax_dev.rake

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ if Gem.loaded_specs.key? 'engine_cart'
4646
puts 'Creating default collection type...'
4747
EngineCart.within_test_app do
4848
raise "EngineCart failed on with: #{$?}" unless system "bundle exec rake hyrax:default_collection_types:create"
49+
50+
# Replace the default sqlite timeout to 15000 (which should triple the timeout). Based on some
51+
# googling, this may help address the "ActiveRecord::StatementInvalid:SQLite3::BusyException:"
52+
# exception that is occassionally breaking the build.
53+
database_yml_content = File.read("config/database.yml")
54+
new_database_yml_content = database_yml_content.gsub(/timeout: +(\d+)/, 'timeout: 15000')
55+
File.open("config/database.yml", "w+") do |f|
56+
f.puts new_database_yml_content
57+
end
4958
end
5059
end
5160
end

0 commit comments

Comments
 (0)