Remove condition based on number of ports
...so that even with a single port, a worker gets it's own upstream. Nginx says this can
lead to performance improvements if some features are enabled. Revisit this later.
1 files changed, 16 insertions, 21 deletions
diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py
index 66b5aa31c6..f2312ea04b 100755
--- a/docker/configure_workers_and_start.py
+++ b/docker/configure_workers_and_start.py
@@ -904,31 +904,26 @@ def generate_worker_files(
# Re process all nginx upstream data. Worker_descriptors contains all the port data,
# cross-reference that with the worker_base_name in requested_worker_types.
for pattern, port_set in nginx_preprocessed_locations.items():
- if len(port_set) > 1:
- # Only process upstreams for multiple port arrangements
- upstream_name: Set[str] = set()
- for worker in worker_descriptors:
- # Find the port we want
- if int(worker["port"]) in port_set:
- # Capture the name. We want the base name as they will be grouped
- # together.
- upstream_name.add(
- requested_worker_types[worker["name"]].get("worker_base_name")
- )
+ upstream_name: Set[str] = set()
+ for worker in worker_descriptors:
+ # Find the port we want
+ if int(worker["port"]) in port_set:
+ # Capture the name. We want the base name as they will be grouped
+ # together.
+ upstream_name.add(
+ requested_worker_types[worker["name"]].get("worker_base_name")
+ )
- # Join it all up nice and pretty with a double underscore
- upstream = "__".join(sorted(upstream_name))
- upstream_location = "http://" + upstream
- # And save the port numbers for writing out below
- nginx_upstreams[upstream] = port_set
-
- else:
- # Only a single port, just use that
- (unpacked_port,) = port_set
- upstream_location = "http://localhost:%d" % unpacked_port
+ # Join it all up nice and pretty with a double underscore
+ upstream = "__".join(sorted(upstream_name))
+ upstream_location = "http://" + upstream
+ # Save the upstream location to it's associated pattern
nginx_locations[pattern] = upstream_location
+ # And save the port numbers for writing out below
+ nginx_upstreams[upstream] = port_set
+
# Build the nginx location config blocks
nginx_location_config = ""
for endpoint, upstream in nginx_locations.items():
|