Differentiate between servers, workers, and scripts during initialization.
Review Request #15246 — Created Aug. 20, 2026 and updated
Review Board's gaining worker support, and already differs when run
backed by a web server or via a script, but until now we've had no way
of telling what mode Review Board is in.This change adds a
process_mode=argument toinitialize()for
specifying a mode. This default todefault, which is used for scripts
or other operations, but can be put intoserverorworkermode.Right now, there's no difference between the modes, but going forward
we'll be able to alter setup or key off some functionality based on the
mode. For example, servers will be able to launch workers, but scripts
and workers will not.The current mode is available via
reviewboard.process.get_rb_process_mode()and via the
$RB_PROCESS_MODEenvironment variable.There's a bit of cleanup in the initialization while here to avoid
redundant or unnecessary calls. Some of this may be updated based on the
process mode in a later change.
All unit tests pass.
Ran locally and saw that Review Board was initialized in server mode.
| Summary | ID |
|---|---|
| 1216ca878ca24a2c0ff1a9bb055f4c187166c669 |
| Description | From | Last Updated |
|---|---|---|
|
manage.py is calling initialize() without a mode, including for runserver. We end up re-initializing on the first request which ends … |
|
|
|
Should the initialize() in rbsite.py set a mode other than DEFAULT? |
|
|
|
StrEnum is Python 3.11+. Existing pattern is to inherit from (str, Enum) with a TODO comment. |
|
|
|
Should be :py:func: |
|
|
|
This has nothing in the manual to link to. |
|
|
|
This seems write-only. Is this here to persist the mode to child processes? If so, initialize() should probably be reading … |
|
|
|
This will crash if called before initialize(). Can we declare the module-level global with a doc comment and type annotation? |
|
-
-
manage.py is calling
initialize()without a mode, including forrunserver. We end up re-initializing on the first request which ends up setting the mode toSERVER, but it would be nice to be explicit. -
-
-
-
-
This seems write-only. Is this here to persist the mode to child processes?
If so,
initialize()should probably be reading this, and settingRBProcessMode.DEFAULTonly if the envvar is empty. -
This will crash if called before
initialize().Can we declare the module-level global with a doc comment and type annotation?