Polling break for loop
If polling a url n times and breaking if response is 'completed', is the best to approach to use try catch and error() to get around immutability? I need the full response on complete so I redo the last http get. It is not a biggie requesting twice. Adam On Fri., 13 Aug. 2021, 6:00 pm , <basex-talk-request@mailman.uni-konstanz.de> wrote:
Send BaseX-Talk mailing list submissions to basex-talk@mailman.uni-konstanz.de
To subscribe or unsubscribe via the World Wide Web, visit https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk or, via email, send a message with subject or body 'help' to basex-talk-request@mailman.uni-konstanz.de
You can reach the person managing the list at basex-talk-owner@mailman.uni-konstanz.de
When replying, please edit your Subject line so it is more specific than "Re: Contents of BaseX-Talk digest..."
Today's Topics:
1. XProc? (Jonathan Robie) 2. Re: XProc? (Martin Honnen) 3. Pretty-print the -V optimized query? See what indexes are used? (Jonathan Robie) 4. Re: XProc? (Imsieke, Gerrit, le-tex) 5. org.basex.core.BaseXException with no error message (Matthew Dziuban) 6. Re: org.basex.core.BaseXException with no error message (Christian Gr?n) 7. Re: Pretty-print the -V optimized query? See what indexes are used? (Christian Gr?n) 8. Can XQuery return unique values present across multiple databases? (Tamara Marnell) 9. Re: Can XQuery return unique values present across multiple databases? (Martin Honnen)
----------------------------------------------------------------------
Message: 1 Date: Thu, 12 Aug 2021 07:58:04 -0400 From: Jonathan Robie <jonathan.robie@gmail.com> To: BaseX <basex-talk@mailman.uni-konstanz.de> Subject: [basex-talk] XProc? Message-ID: < CAOkFc+vMLcdXFUZBUvZZVLF8Wc3nKSLASpPKFWV_WPh7hRnEFw@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
What hooks does BaseX provide for XProc? Where can I find examples of BaseX use in an XProc pipeline?
Jonathan
If polling a url n times and breaking if response is 'completed', is the best to approach to use try catch and error() to get around immutability? I need the full response on complete so I redo the last http get. It is not a biggie requesting twice. Adam
The hof:until function may help you [1]. Don’t hesitate to supply us with a minimized code snippet. In general, it’s almost always a good advice not to use try/catch unless you need to catch real errors. [1] https://docs.basex.org/wiki/Higher-Order_Functions_Module#hof:until
Hi Christian - many thanks for the pointer. hof:until works well and without a double http:send-request. let $pollingResult := hof:until(function($result) {$result?3//status/text()= 'done'},function ($input){[$input?1 + 1,prof:sleep(5000),http:send-request($requestPolling)]}, [1,0,http:send-request($requestPolling)]) On Fri, Aug 13, 2021 at 6:29 PM Christian Grün <christian.gruen@gmail.com> wrote:
If polling a url n times and breaking if response is 'completed', is the best to approach to use try catch and error() to get around immutability? I need the full response on complete so I redo the last http get. It is not a biggie requesting twice. Adam
The hof:until function may help you [1]. Don’t hesitate to supply us with a minimized code snippet.
In general, it’s almost always a good advice not to use try/catch unless you need to catch real errors.
[1] https://docs.basex.org/wiki/Higher-Order_Functions_Module#hof:until
Slight improvement let $polling := hof:until(function($result) {$result?3//status/text()= 'done' or $result?1 > 10},function ($input){[$input?1 + 1,prof:sleep(5000),http:send-request($requestPolling)]}, [1,0,http:send-request($requestPolling)])
participants (2)
-
Adam Law -
Christian Grün