2017-09-07 36 views
0

由於某種原因,我的應用程序今天上午停止了工作。提交作業後,發出請求爲它的狀態時,它只返回acceptedHERE API從不運行批處理作業,始終返回接受狀態

這裏是我用來創建和運行作業代碼:

$url = "https://batch.geocoder.api.here.com/6.2/jobs?action=run&app_code=".$app_code."&app_id=".$app_id."&[email protected]&outcols=latitude,longitude,locationLabel&outputcombined=true&indelim=|&outdelim=|&language=hu-HU&header=true"; 
    if($cURLHandler) { 
     curl_setopt($cURLHandler, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); 
     curl_setopt($cURLHandler, CURLOPT_BINARYTRANSFER, true); 
     curl_setopt($cURLHandler, CURLOPT_POST, true); 
     curl_setopt($cURLHandler, CURLOPT_RETURNTRANSFER, true); 
     curl_setopt($cURLHandler, CURLOPT_POSTFIELDS, file_get_contents($userFolderURL."/batchjob.txt")); 
     curl_setopt($cURLHandler, CURLOPT_URL, $url); 

     $cURLResults = curl_exec($cURLHandler); 

     curl_close($cURLHandler); 
    } 

這是一個例子batchjob的內容.TXT:

recId|searchText|country 
1|"2120 Dunakeszi Barátság útja 18"|HUN 
2|"2120 Dunakeszi Barátság útja 18"|HUN 
3|"2120 Dunakeszi Baràtsàg útja 12"|HUN 
4|"2120 Dunakeszi Barátság utja 49"|HUN 
5|"2120 Dunakeszi Barátság útja 3"|HUN 
6|"2120 Dunakeszi Barátság útja.30"|HUN 
7|"2120 Dunakeszi Bátorkeszi utca 7."|HUN 
8|"2120 Dunakeszi bercsényi u 27"|HUN 
9|"2120 Dunakeszi Déli utca 12."|HUN 

創建和運行的工作後,我檢查它的狀態,每10秒,下列curl請求:

$url = "https://batch.geocoder.api.here.com/6.2/jobs/".$requestID."?action=status&app_code=".$app_code."&app_id=".$app_id; 

$ch = curl_init(); 
if($ch) { 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain')); 
    curl_setopt($ch, CURLOPT_HTTPGET, true); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    $result = curl_exec($ch); 
    curl_close($ch); 
} 

但它始終返回下面的XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"><Response><MetaInfo><RequestId>REQUESTID ommited</RequestId></MetaInfo><Status>accepted</Status><TotalCount>0</TotalCount><ValidCount>0</ValidCount><InvalidCount>0</InvalidCount><ProcessedCount>0</ProcessedCount><PendingCount>0</PendingCount><SuccessCount>0</SuccessCount><ErrorCount>0</ErrorCount></Response></ns2:SearchBatch> 

我仔細檢查了,我的應用程序代碼&應用程序ID都是有效的,所以我真的看不出理由爲什麼發生這種情況。

根據official docs,我的第一個cURL請求應該創建&開始工作,但是由於某種原因,它似乎永遠不會?這裏可能是什麼問題?

回答

1

「已接受」狀態表示您的工作已排隊並正在等待插槽執行。我們在這裏正在監控隊列以確保容量根據需要進行調整。

所以我想你的應用程序是好的,瓶頸可能在我們這邊。

+0

我很確定這是個問題 - 幾天後一切都恢復正常。 – PeterInvincible