2017-09-20 78 views
0

具有10000個數據的表並使用查詢(jql)從表中獲取特定的數據。提取的計數是正確的,它是673,但打開那些數據時它只發送100個數據。 這是我的代碼:JS parase數據從近8000個表中發送JSON格式的100個數據

request({ 
///////////////////////////////////// 
//query to get current open tickets// 
///////////////////////////////////// 
url: '/rest/api/2/search?jql=project=OWRT AND status in (Open, "In Progress", Reopened)&startAt=0&maxResults=-1', 
success: function(response) { 
    var owrt = $.parseJSON(response); 
    var liktot = parsedata(response,'owrt'); 
console.log("OWRT max"+owrt.maxResults); 
    request({ 
    //////////////////////////////////////////////////// 
    //query to get current resolved and closed tickets// 
    //////////////////////////////////////////////////// 
    url: '/rest/api/2/search?jql=project=OWRT AND status not in (Open, "In Progress", Reopened)', 
    success: function(response1) { 
    var fixowrt = $.parseJSON(response1); 
    var owrt_tot=owrt.total; 
    request({ 
    ////////////////////////////////////////// 
    //query to get year 2016 created tickets// 
    ////////////////////////////////////////// 
    url: '/rest/api/2/search?jql=project = OWRT AND created >= 2016-01-01 AND created <= 2016-12-31', 
    success: function(response2) { 
     var cowrt = $.parseJSON(response2); 
     request({ 
     ////////////////////////////////////////// 
     //query to get year 2017 created tickets// 
     ////////////////////////////////////////// 
     url: '/rest/api/2/search?jql=project = OWRT AND created >= 2017-01-01 AND created <= 2017-12-31&maxResults=-1', 
     success: function(response3) { 
    var cfixowrt = $.parseJSON(response3); 
     var owrtcre17 = parsedata(response3,'owrt2017'); 
     var cowrt_tot=cowrt.total; 
     request({ 
    ///////////////////////////////////////// 
    //query to get year 2016 closed tickets// 
    ///////////////////////////////////////// 
     url: '/rest/api/2/search?jql=project = OWRT AND status = Closed AND updated >= 2016-01-01 AND updated <= 2016-12-31', 
    success: function(response4) { 
      var fowrt = $.parseJSON(response4); 
      request({ 
     ///////////////////////////////////////// 
     //query to get year 2017 closed tickets// 
     ///////////////////////////////////////// 
      url: '/rest/api/2/search?jql=project = OWRT AND status = Closed AND updated >= 2017-01-01 AND updated <= 2017-12-31', 
     success: function(response5) { 
     var ffixowrt = $.parseJSON(response5); 
      var fowrt_tot=fowrt.total; 
      request({ 
     //////////////////////////////////////////// 
     //query to get all tickets in this project// 
     //////////////////////////////////////////// 
      url: '/rest/api/2/search?jql=project=OWRT', 
     success: function(response6) { 
       console.log("start1:"+reqcount); 
      var fullowrt = $.parseJSON(response6); 
      var fullowrt_tot = fullowrt.total 
       var obj = {}; 
      obj['key']='OWRT'; 
      obj['tot']=owrt_tot; 
      obj['totlink']=liktot[0]; 
      obj['ntotlink']=liktot[1]; 
      obj['fixntotlink']=fixowrt.total; 
      obj['ckey']='OWRT'; 
      obj['ctot']=cowrt_tot; 
      obj['cre17totlink']=owrtcre17[0]; 
      obj['cre17ntotlink']=owrtcre17[1]; 
      obj['cfixntotlink']=cfixowrt.total; 
      obj['fkey']='OWRT'; 
      obj['ftot']=fowrt_tot; 
      obj['ffixntotlink']=ffixowrt.total; 
      obj['fulltot']=fullowrt.total; 
      summary.push(obj); 
      reqcount=reqcount+1; 
     requestexe(); 
      }, 
      error: function(response) { 
      console.log("Error loading API (" + uri + ")"); 
      console.log(arguments); 
      }, 
      data: {"fields":["key"]}, 
      contentType: "application/json" 
      }); 
      requestexe(); 
      }, 
      error: function(response) { 
      console.log("Error loading API (" + uri + ")"); 
      console.log(arguments); 
      }, 
      data: {"fields":["key"]}, 
      contentType: "application/json" 
      }); 
     requestexe(); 
     }, 
     error: function(response) { 
     console.log("Error loading API (" + uri + ")"); 
     console.log(arguments); 
     }, 
     data: {"fields":["key"]}, 
     contentType: "application/json" 
     }); 
     requestexe(); 
     }, 
     error: function(response) { 
     console.log("Error loading API (" + uri + ")"); 
     console.log(arguments); 
     }, 
     data: {"fields":["key","id","status","project","issuetype","issuelinks", "summary", "assignee", "type",'created']}, 
     contentType: "application/json" 
     }); 
    requestexe(); 
    }, 
    error: function(response) { 
    console.log("Error loading API (" + uri + ")"); 
    console.log(arguments); 
    }, 
    data: {"fields":["key"]}, 
    contentType: "application/json" 
    }); 
    requestexe(); 
    }, 
    error: function(response) { 
    console.log("Error loading API (" + uri + ")"); 
    console.log(arguments); 
    }, 
    data: {"fields":["key"]}, 
    contentType: "application/json" 
    }); 
requestexe(); 
}, 
error: function(response) { 
console.log("Error loading API (" + uri + ")"); 
console.log(arguments); 
}, 
data: {"fields":["key","id","status","project","issuetype","issuelinks", "summary", "assignee", "type",'created']}, 
contentType: "application/json" 
}); 

當看該查詢的總數,這是「owrt_tot」正在發送正確的,但來自其僅發送100,其是fectching數據時包括「liktot [0]」 +「 liktot 1「。 the final outcome of data

但總數是673,但數據從上面的代碼發送僅100這個總數是高達1000之後幾天繼續運行代碼之前領我到100所以有什麼,內存是一個問題還是需要更改代碼?

+0

嵌套你的請求不僅是非常容易出錯,但它看起來很糟糕。我認爲你先分開你的請求,然後檢查你的結果。也許你的錯誤解決了。否則,請隨時發佈重構版本。檢查此https://stackoverflow.com/questions/12101687/nested-requests-are-blocking?answertab=votes#tab-top – Akaino

回答

0

這是JIRA atlassian api的問題。驗證與atlassian支持,他們有目的地限制