Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#169 added parameter for debug wait timeout. #185

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ declare option xdmp:mapping "false";

(: Half a million lines of XQuery ought to be enough for any module. :)
declare variable $LIMIT as xs:integer := 654321 ;
declare variable $TIMEOUT := "%%mlDebugWaitTimeout%%";
declare variable $DEFAULT_TIMEOUT := 10;

declare private function cover:_put(
$map as map:map,
Expand Down Expand Up @@ -71,8 +73,8 @@ declare private function cover:_task-cancel-safe(
for $breakpoint in dbg:breakpoints($id)
return dbg:clear($id, $breakpoint),
dbg:detach($id),
if (fn:empty(dbg:wait($id, 10))) then
fn:error(xs:QName("FAILED-TO-CANCEL"), "unable to cancel a debugging request")
if (fn:empty(dbg:wait($id, if ($TIMEOUT eq "%%mlDebugWaitTimeout%%") then $DEFAULT_TIMEOUT else $TIMEOUT)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this reference will be replaced as well, so it will resolve to e.g. "if ($TIMEOUT eq 8)", and it will in fact equal 8 - which means DEFAULT_TIMEOUT will be used instead.

I think you want to do an fn:contains here on "mlDebugWaitTimeout".

I'm still hesitant though about having this rely on a feature of ml-gradle. How about if this depends on a server field instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning towards a server field here. In my experience, unit tests typically run against a single-node cluster, so the issue of a server field being set on one host but not another won't matter. In a 3+ node cluster, it's still simple enough to have all requests go to the same host.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expecting a single node to be used and NOT a load balancer feels brittle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. How about if we do %%marklogicUnitTestDebugTimeout%%? That makes it clear it's specific to marklogic-unit-test (wish that itself had a much shorter, snappier name).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peetkes Just a note, I'm happy to merge this with the above changes.

then fn:error(xs:QName("FAILED-TO-CANCEL"), "unable to cancel a debugging request")
else ()
}
catch ($ex) {
Expand Down