discourse/lib/file_store
Alan Guo Xiang Tan 30896b6d0e
PERF: Run primary and parallel DB setup concurrently in CI (#40319)
Reattempt of #40294, which was reverted in #40301 because two concurrent
processes raced on plugin symlink creation in
`Discourse::Utils.atomic_ln_s`. The first commit here fixes that race at
the source by serializing the check-and-replace with a file lock and
switching to `File.rename` (atomic on POSIX, doesn't follow symlinks at
the destination). A stress test of the previous implementation failed
15/16 workers under contention; the new implementation passes 5/5 stress
runs and 5/5 end-to-end CI-like runs locally with `LOAD_PLUGINS=1`.

The second commit is the parallelization itself: the two CI
database-setup steps run concurrently through GNU `parallel` instead of
one after the other. It also adds `Discourse.test_env_number` to align
the `TEST_ENV_NUMBER=""` interpretation across `FileStore::BaseStore`,
`Stylesheet::Manager`, `S3Helper`, and `BackupRestore::S3BackupStore`
with `config/boot.rb` — without this, the gem's first worker and the
primary process would race on `public/uploads/default/test_0/`.
2026-05-29 06:46:32 +08:00
..
base_store.rb PERF: Run primary and parallel DB setup concurrently in CI (#40319) 2026-05-29 06:46:32 +08:00
local_store.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
s3_store.rb DEV: Fix assigned but unused variable Prism warnings (#39436) 2026-04-22 12:42:14 +02:00
to_s3_migration.rb FIX: Truncate long filenames in S3 Content-Disposition header (#39170) 2026-04-13 10:14:06 +02:00