zulip/zerver
Tim Abbott 8339c21637 test-backend: Fix db issues with running two copies in parallel.
Sometimes it's useful to run two copies of test-backend at the same
time.  The problem with doing so is that we need to make sure no two
threads are using the same test database ID.

Previously, this worked only if at most one of those copies was
running in the single-threaded mode, because we used a random database
ID for the single-threaded code path, but the same IDs counting from 0
for the parallel code path.

Fix this, mostly, by generating a random start for the range of IDs
used by the process, and then counting off database IDs starting from
there (both in the parallel and non-paralllel modes).

There's still a very low probability race, see the TODO.
Additionally, there appear to be some other races with running two
copies of test-backend at the same time not related to the database.

See https://github.com/zulip/zulip/issues/12426 for a follow-up issue
that's sorta created by this.
2019-05-28 16:38:45 -07:00
..
data_import lint: Fix code that evaded our lint checks for string % non-tuple. 2019-04-23 15:21:37 -07:00
lib test-backend: Fix db issues with running two copies in parallel. 2019-05-28 16:38:45 -07:00
management export: Rename `--upload-to-s3` to be `--upload`. 2019-05-20 19:59:57 -07:00
migrations models: Alter video_chat_provider field type to integer. 2019-05-13 12:02:28 -07:00
openapi settings: Migrate to create_stream_policy structure. 2019-05-06 16:27:55 -07:00
templatetags render_markdown_path: Convert dicts to dict item tuples for caching. 2019-04-22 13:53:18 -07:00
tests import: Replace data-user-group-id in rendered_content. 2019-05-28 12:53:20 -07:00
tornado tornado: Remove unused imports. 2019-02-02 17:33:13 -08:00
views authenticate: Remove default values for required parameters. 2019-05-27 23:47:22 -07:00
webhooks webhooks/jira: Fix markup conversion of full links. 2019-05-27 23:41:11 -07:00
worker export: Add LOCAL_UPLOADS_DIR support to the export feature. 2019-05-27 20:06:35 -07:00
__init__.py
apps.py python: Mark intentionally unused imports with noop statements. 2019-02-22 16:54:47 -08:00
context_processors.py open graph: Uploaded realm icon URL is absolute for some backends. 2019-05-20 13:14:28 -07:00
decorator.py rate_limiter: Generalise some rate_limit_user code. 2019-05-01 12:54:32 -07:00
filters.py filters: Don't include realm_counts/installation_counts in errors. 2019-04-30 14:10:59 -07:00
forms.py authenticate: Remove default values for required parameters. 2019-05-27 23:47:22 -07:00
logging_handlers.py try_git_describe: Set cwd, not --git-dir. 2019-02-28 14:59:33 -08:00
middleware.py get_realm: raise DoesNotExist instead of returning None. 2019-05-06 21:58:16 -07:00
models.py archives: Display globe icon for web public streams. 2019-05-20 18:13:31 -07:00
signals.py zerver core: Remove unused imports. 2019-02-02 17:41:24 -08:00
static_header.txt