forked from FarmMaps/FarmMapsApiClient
specify how many seconds to wait for the KPItask to be completed
This commit is contained in:
@@ -365,12 +365,13 @@ namespace FarmmapsApi.Services
|
||||
return bofekItem;
|
||||
}
|
||||
|
||||
public async Task<List<Item>> GetKpiItemsForCropField(Item cropfieldItem)
|
||||
public async Task<List<Item>> GetKpiItemsForCropField(Item cropfieldItem, int waitsecs = 6)
|
||||
{
|
||||
TaskRequest kpiRequest = new TaskRequest { TaskType = KPI_TASK };
|
||||
kpiRequest.attributes["processAggregateKpi"] = "false";
|
||||
int year = cropfieldItem.DataDate.Value.Year;
|
||||
kpiRequest.attributes["year"] = year.ToString();
|
||||
int ms = waitsecs * 1000;
|
||||
|
||||
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, kpiRequest);
|
||||
|
||||
@@ -387,7 +388,9 @@ namespace FarmmapsApi.Services
|
||||
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
|
||||
return null;
|
||||
}
|
||||
await Task.Delay(6000); // wait 6000 secs for task to be completed
|
||||
_logger.LogInformation($"Taking {waitsecs} seconds to look up all KPI items. The longer we wait the more KPI's we get ..." +
|
||||
$"");
|
||||
await Task.Delay(ms); // wait 60000ms = 60 secs for task to be completed
|
||||
|
||||
//After the task is completed we have 1 kpiContainerItem with a code and with no data
|
||||
//Because the data are in the children of this kpiContainerItem. The container will have a list of children each with an "id" aand data,
|
||||
|
Reference in New Issue
Block a user