Precompile native modules off request path
This commit is contained in:
@@ -181,9 +181,26 @@ wait "$rebuild_lock_pid"
|
||||
# parent CLI request must wait and render the new child, never its stale wasm.
|
||||
printf '%s\n' 'COMPONENT(Request& context) { print("nested-component-marker-a"); }' >"$source_dir/nested-child.uce"
|
||||
printf '%s\n' \
|
||||
'CLI(Request& context) { DValue props; print(component("nested-child", props, context)); }' >"$source_dir/nested-parent.uce"
|
||||
'CLI(Request& context) { DValue props; print(component("nested-child", props, context)); }' \
|
||||
'RENDER(Request& context) { DValue props; print(component("nested-child", props, context)); }' >"$source_dir/nested-parent.uce"
|
||||
assert_marker nested-parent nested-component-marker-a
|
||||
nested_child_wasm="$cache_dir/nested-child.uce.wasm"
|
||||
|
||||
# A proactive source rebuild must publish the native serialized module before
|
||||
# any request worker has to load the changed unit.
|
||||
nested_parent_cwasm="$cache_dir/nested-parent.uce.cwasm"
|
||||
rm -f "$nested_parent_cwasm"
|
||||
printf '%s\n' \
|
||||
'CLI(Request& context) { DValue props; print(component("nested-child", props, context)); /* proactive-serialization-v2 */ }' \
|
||||
'RENDER(Request& context) { DValue props; print(component("nested-child", props, context)); /* proactive-serialization-v2 */ }' >"$source_dir/nested-parent.uce"
|
||||
curl -fsS -H "Host: $http_host" "http://127.0.0.1/$test_name/nested-parent.uce" >/dev/null
|
||||
deadline=$((SECONDS + 10))
|
||||
while [[ ! -s "$nested_parent_cwasm" && $SECONDS -lt $deadline ]]; do sleep 0.1; done
|
||||
if [[ ! -s "$nested_parent_cwasm" ]]; then
|
||||
echo "proactive compiler did not serialize rebuilt module" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
exec 8>"$nested_child_wasm.lock"
|
||||
flock 8
|
||||
|
||||
Reference in New Issue
Block a user