Skip to content

Commit ff0c290

Browse files
committed
Added trap handler for cluster.waitForJobCompletion(), adjust logic for domain extraction on extractPrincipalIdentifiers() to be more precise
1 parent bd9996b commit ff0c290

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

js/gitana/Chainable.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,18 @@
554554
}
555555
else if (principal["_doc"])
556556
{
557-
identifiers["domain"] = defaultDomainId;
557+
identifiers["domain"] = principal["domainId"];
558+
if (!identifiers["domain"]) {
559+
identifiers["domain"] = defaultDomainId;
560+
}
558561
identifiers["principal"] = principal["_doc"];
559562
}
560563
else if (principal["name"])
561564
{
562-
identifiers["domain"] = defaultDomainId;
565+
identifiers["domain"] = principal["domainId"];
566+
if (!identifiers["domain"]) {
567+
identifiers["domain"] = defaultDomainId;
568+
}
563569
identifiers["principal"] = principal["name"];
564570
}
565571

js/gitana/cluster/Cluster.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,20 @@
238238
{
239239
window.setTimeout(function() {
240240

241-
Chain(chainable).readJob(jobId).then(function() {
241+
Chain(chainable).trap(function(e) {
242+
if (e) { console.log(e); }
243+
callback(null, e);
244+
return false;
245+
}).readJob(jobId).then(function() {
242246

243247
if(progressCallback && Gitana.isFunction(progressCallback)) {
244248
progressCallback(this);
245249
}
246250

247-
if (this.state == "FINISHED") {
251+
if (this.state === "FINISHED") {
248252
callback(this);
249253
chainable.next();
250-
} else if (this.state == "ERROR") {
254+
} else if (this.state === "ERROR") {
251255
callback(this);
252256
chainable.next();
253257
} else {

0 commit comments

Comments
 (0)