Invalidate component freshness by source generation
This commit is contained in:
@@ -118,6 +118,24 @@ if [[ "$http_component_output" != *"http-component-marker-b"* ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' 'String http_component_dependency_marker() { return("http-component-dependency-a"); }' >"$source_dir/http-component-dependency.uce"
|
||||
printf '%s\n' '#load "http-component-dependency.uce"' 'COMPONENT(Request& context) { print(http_component_dependency_marker()); }' >"$source_dir/http-transitive-child.uce"
|
||||
printf '%s\n' 'RENDER(Request& context) { DValue props; print(component("http-transitive-child", props, context)); }' >"$source_dir/http-transitive-parent.uce"
|
||||
http_transitive_marker() {
|
||||
curl -fsS -H "Host: $http_host" "http://127.0.0.1/$test_name/http-transitive-parent.uce"
|
||||
}
|
||||
if [[ "$(http_transitive_marker)" != *"http-component-dependency-a"* ]]; then
|
||||
echo "HTTP transitive component warm-up did not return dependency-a" >&2
|
||||
exit 1
|
||||
fi
|
||||
sed -i 's/http-component-dependency-a/http-component-dependency-b/' "$source_dir/http-component-dependency.uce"
|
||||
deadline=$((SECONDS + 20))
|
||||
while [[ "$(http_transitive_marker)" != *"http-component-dependency-b"* && $SECONDS -lt $deadline ]]; do sleep 0.2; done
|
||||
if [[ "$(http_transitive_marker)" != *"http-component-dependency-b"* ]]; then
|
||||
echo "HTTP dynamic component did not converge after its loaded dependency changed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Mutations must never execute a stale dynamically resolved component, even
|
||||
# inside the short read-only freshness memo window.
|
||||
http_component_wasm="$cache_dir/http-component-child.uce.wasm"
|
||||
|
||||
Reference in New Issue
Block a user