Name
cx:wait-for-update — Pause execution until a URI has changed.
Synopsis
<p:declare-step
type
="
cx:wait-for-update
"
xmlns:cx
="
http://xmlcalabash.com/ns/extensions
"
>
<p:output
port
="
result
"
/>
<p:option
name
="
href
"
required
="
true
"
/>
<!--
xd:anyURI -->
<p:option
name
="
pause-before
"
/>
<!--
int -->
<p:option
name
="
pause-after
"
/>
<!--
int -->
</p:declare-step>
Description
This step pauses execution of the pipeline until the URI specified in
the href
option has changed. At present, only file:
and http:
(https:
) URIs are supported.
Additionally, the following options are supported:
pause-before
-
If specified, the step will unconditionally pause for
pause-before
seconds before beginning to test for updates. pause-after
-
If specified, the step will unconditionally pause for
pause-after
seconds after detecting an update.
For the purpose of determining if a file has changed, one of the following conditions must be satisfied:
-
If the file does not exist when the step begins running, then it is deemed to have changed as soon as it is seen to exist.
-
If the file exists when the step begins running, then it is deemed to have changed as soon as the last modified time changes.
For the purpose of determining if an HTTP URI has changed, one of the following conditions must be satisfied:
-
If a HEAD request returns 404 when the step begins running, then it is deemed to have changed as soon as it returns something else.
-
If HEAD returns 200 when the step begins running, then it is deemed to have changed as soon as the last modified time changes. The last modified time is taken from the
last-modified
header, if it exists, or thedate
header if it exists.
It follows that if neither header exists, or if the server returns anything other than 200 or 404, the URI is deemed to exist.