Module: Evilution::ParallelDbWarning
- Defined in:
- lib/evilution/parallel_db_warning.rb
Overview
EV-kdns / GH #817: nudge users running parallel jobs against SQLite to adopt the parallel_tests convention. WorkQueue sets TEST_ENV_NUMBER per worker, but that only helps if config/database.yml interpolates it into the database path. Without per-worker DB files, concurrent workers pile up on one SQLite file and surface ActiveRecord::StatementTimeout / SQLite3::BusyException — noise that MutationExecutor demotes to :neutral but still wastes wall-clock time.
Constant Summary collapse
- DATABASE_YML =
File.join("config", "database.yml")
- MESSAGE =
"[evilution] Parallel run (jobs > 1) detected with SQLite in " \ "config/database.yml. Interpolate ENV['TEST_ENV_NUMBER'] into the " \ "test database path for per-worker DB isolation. See README."
Class Method Summary collapse
Class Method Details
.reset! ⇒ Object
36 37 38 |
# File 'lib/evilution/parallel_db_warning.rb', line 36 def reset! @mutex.synchronize { @warned_roots.clear } end |
.warn_if_sqlite_parallel(config, output: $stderr, root: Dir.pwd) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/evilution/parallel_db_warning.rb', line 23 def warn_if_sqlite_parallel(config, output: $stderr, root: Dir.pwd) return unless config.jobs > 1 return unless sqlite_in_test_config?(root) @mutex.synchronize do return if @warned_roots[root] @warned_roots[root] = true end output.puts(MESSAGE) end |