Skip to content

Commit 2bf4076

Browse files
namedgraphclaude
andauthored
Load view and document metadata in parallel (#444)
* Load view and document metadata in parallel The object labels (/sparql), the ontology object labels (/ns) and the property labels (/ns) are all built from the results alone, so the view, ontology-view and document-load chains now fire them together through ldh:fire-load-set-parallel instead of one after another. Driven on the local LTLOD stack with Playwright, serving a baseline and a patched site SEF through page.route: the three requests start together, the rendered content is unchanged, and the calendar pages finish their block loading ~100-125 ms (4-5%) sooner; the homepage shows no difference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * A block load superseded by navigation reports nothing A content block's load chain outlives its pane: going back or on while the blocks are still loading replaces the pane, and the chain runs on against a detached block. There it fails - key() has no containing document (XTDE1270) - and ldh:promise-failure, handed the detached content body, fell through to the alert() kept for dialogs closed while their request was in flight. ldh:block-load-failure passes the content body on only while it is still in the page, checked when the failure arrives. Without a host ldh:promise-failure only resets the cursor and the busy regions. Loading the metadata in parallel made the race reliable: the results table spec, which leaves for the root document and comes straight back, failed on every attempt (UI-tests run 39172274618). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d70ca2a commit 2bf4076

3 files changed

Lines changed: 29 additions & 36 deletions

File tree

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client.xsl‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ WHERE
771771
<xsl:otherwise>
772772
<xsl:for-each select="$factories">
773773
<xsl:variable name="factory" select="."/>
774-
<ixsl:promise select="$factory(())" on-failure="ldh:promise-failure($content-body, 'failed-to-load-block-data', ?)"/>
774+
<ixsl:promise select="$factory(())" on-failure="ldh:block-load-failure($content-body, ?)"/>
775775
</xsl:for-each>
776776
</xsl:otherwise>
777777
</xsl:choose>
@@ -841,15 +841,26 @@ WHERE
841841
</xsl:if>
842842
</xsl:function>
843843

844-
<!-- failure twin of ldh:block-hydrated: reports the error like ldh:promise-failure would, then counts the block down all the same so the deferred scroll is not stuck pending -->
844+
<!-- reports a content block's failed load in its pane. A pane that has left the page was replaced by a later
845+
navigation, which superseded the load: the chain ran on against a detached block and failed there, and that is
846+
nothing to report - no host, so ldh:promise-failure only resets the cursor and the busy regions. Checked when the
847+
failure arrives, not when the load starts -->
848+
<xsl:function name="ldh:block-load-failure" ixsl:updating="yes">
849+
<xsl:param name="host" as="element()?"/> <!-- the pane's content body -->
850+
<xsl:param name="error" as="map(*)"/>
851+
852+
<xsl:sequence select="ldh:promise-failure($host[ancestor::body], 'failed-to-load-block-data', $error)"/>
853+
</xsl:function>
854+
855+
<!-- failure twin of ldh:block-hydrated: reports the error like ldh:block-load-failure, then counts the block down all the same so the deferred scroll is not stuck pending -->
845856
<xsl:function name="ldh:block-hydration-failure" ixsl:updating="yes">
846857
<xsl:param name="host" as="element()?"/> <!-- the pane's content body -->
847858
<xsl:param name="scroll-id" as="xs:string"/>
848859
<xsl:param name="doc-uri" as="xs:anyURI"/>
849860
<xsl:param name="fragment" as="xs:string"/>
850861
<xsl:param name="error" as="map(*)"/>
851862

852-
<xsl:sequence select="ldh:promise-failure($host, 'failed-to-load-block-data', $error)"/>
863+
<xsl:sequence select="ldh:block-load-failure($host, $error)"/>
853864
<xsl:sequence select="ldh:block-hydrated($scroll-id, $doc-uri, $fragment, ())"/>
854865
</xsl:function>
855866

@@ -1045,18 +1056,12 @@ WHERE
10451056
ixsl:then(ldh:rethread-response($context, ?)) =>
10461057
ixsl:then(ldh:handle-response#1) =>
10471058
ixsl:then(ldh:load-diff-version#1) =>
1048-
ixsl:then(ldh:load-object-metadata#1) =>
1049-
ixsl:then(ldh:http-request-threaded(?, 'metadata-request', 'metadata-response')) =>
1050-
ixsl:then(ldh:handle-response(?, 'metadata-response')) =>
1051-
ixsl:then(ldh:set-object-metadata#1) =>
1052-
ixsl:then(ldh:http-request-threaded(?, 'ns-metadata-request', 'ns-metadata-response')) =>
1053-
ixsl:then(ldh:handle-response(?, 'ns-metadata-response')) =>
1054-
ixsl:then(ldh:set-object-metadata-ns#1) =>
1059+
ixsl:then(ldh:fire-load-set-parallel(?, [
1060+
[ ldh:load-object-metadata#1, 'metadata-request', 'metadata-response', ldh:set-object-metadata#1 ],
1061+
[ ldh:load-object-metadata#1, 'ns-metadata-request', 'ns-metadata-response', ldh:set-object-metadata-ns#1 ],
1062+
[ ldh:load-property-metadata#1, 'property-metadata-request', 'property-metadata-response', ldh:set-property-metadata#1 ]
1063+
])) =>
10551064
ixsl:then(ldh:merge-object-metadata#1) =>
1056-
ixsl:then(ldh:load-property-metadata#1) =>
1057-
ixsl:then(ldh:http-request-threaded(?, 'property-metadata-request', 'property-metadata-response')) =>
1058-
ixsl:then(ldh:handle-response(?, 'property-metadata-response')) =>
1059-
ixsl:then(ldh:set-property-metadata#1) =>
10601065
ixsl:then(ldh:rdf-document-response#1)"
10611066
on-failure="ldh:promise-failure(id('tab-content', ixsl:page()), 'document-not-loaded', ?)"/>
10621067
</xsl:template>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client/block.xsl‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,18 +1013,12 @@ exclude-result-prefixes="#all"
10131013
ixsl:http-request($view-context('request')) =>
10141014
ixsl:then(ldh:rethread-response($view-context, ?)) =>
10151015
ixsl:then(ldh:handle-response#1) =>
1016-
ixsl:then(ldh:load-object-metadata#1) =>
1017-
ixsl:then(ldh:http-request-threaded(?, 'metadata-request', 'metadata-response')) =>
1018-
ixsl:then(ldh:handle-response(?, 'metadata-response')) =>
1019-
ixsl:then(ldh:set-object-metadata#1) =>
1020-
ixsl:then(ldh:http-request-threaded(?, 'ns-metadata-request', 'ns-metadata-response')) =>
1021-
ixsl:then(ldh:handle-response(?, 'ns-metadata-response')) =>
1022-
ixsl:then(ldh:set-object-metadata-ns#1) =>
1016+
ixsl:then(ldh:fire-load-set-parallel(?, [
1017+
[ ldh:load-object-metadata#1, 'metadata-request', 'metadata-response', ldh:set-object-metadata#1 ],
1018+
[ ldh:load-object-metadata#1, 'ns-metadata-request', 'ns-metadata-response', ldh:set-object-metadata-ns#1 ],
1019+
[ ldh:load-property-metadata#1, 'property-metadata-request', 'property-metadata-response', ldh:set-property-metadata#1 ]
1020+
])) =>
10231021
ixsl:then(ldh:merge-object-metadata#1) =>
1024-
ixsl:then(ldh:load-property-metadata#1) =>
1025-
ixsl:then(ldh:http-request-threaded(?, 'property-metadata-request', 'property-metadata-response')) =>
1026-
ixsl:then(ldh:handle-response(?, 'property-metadata-response')) =>
1027-
ixsl:then(ldh:set-property-metadata#1) =>
10281022
ixsl:then(ldh:ontology-view-render-thunk#1)
10291023
}) => ixsl:then(ldh:ontology-views-inserted($context, ?))
10301024
"/>

‎src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client/block/view.xsl‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,12 @@ exclude-result-prefixes="#all"
168168
ixsl:then(ldh:rethread-response($context, ?, 'view-results-response')) =>
169169
ixsl:then(ldh:handle-response(?, 'view-results-response')) =>
170170
ixsl:then(ldh:view-results-error-handler#1) =>
171-
ixsl:then(ldh:load-object-metadata(?, 'view-results-response')) =>
172-
ixsl:then(ldh:http-request-threaded(?, 'metadata-request', 'metadata-response')) =>
173-
ixsl:then(ldh:handle-response(?, 'metadata-response')) =>
174-
ixsl:then(ldh:set-object-metadata#1) =>
175-
ixsl:then(ldh:http-request-threaded(?, 'ns-metadata-request', 'ns-metadata-response')) =>
176-
ixsl:then(ldh:handle-response(?, 'ns-metadata-response')) =>
177-
ixsl:then(ldh:set-object-metadata-ns#1) =>
171+
ixsl:then(ldh:fire-load-set-parallel(?, [
172+
[ ldh:load-object-metadata(?, 'view-results-response'), 'metadata-request', 'metadata-response', ldh:set-object-metadata#1 ],
173+
[ ldh:load-object-metadata(?, 'view-results-response'), 'ns-metadata-request', 'ns-metadata-response', ldh:set-object-metadata-ns#1 ],
174+
[ ldh:load-property-metadata(?, 'view-results-response'), 'property-metadata-request', 'property-metadata-response', ldh:set-property-metadata#1 ]
175+
])) =>
178176
ixsl:then(ldh:merge-object-metadata#1) =>
179-
ixsl:then(ldh:load-property-metadata(?, 'view-results-response')) =>
180-
ixsl:then(ldh:http-request-threaded(?, 'property-metadata-request', 'property-metadata-response')) =>
181-
ixsl:then(ldh:handle-response(?, 'property-metadata-response')) =>
182-
ixsl:then(ldh:set-property-metadata#1) =>
183177
ixsl:then(ldh:render-view#1)
184178
"/>
185179
</xsl:function>

0 commit comments

Comments
 (0)