fix uploading
This commit is contained in:
		| @@ -68,10 +68,7 @@ namespace FarmmapsApi.Services | ||||
|             contentStream.ThrowIfNull(nameof(contentStream)); | ||||
|              | ||||
|             _streamLength = ContentStream.CanSeek ? ContentStream.Length : UnknownSize; | ||||
|  | ||||
|             var twoMB = 2 * 0x100000; | ||||
|             ChunkSize = twoMB; | ||||
|             body.ChunkSize = ChunkSize; | ||||
|             ChunkSize = 2 * 0x100000; | ||||
|             Body = body; | ||||
|              | ||||
|             Path = path; | ||||
|   | ||||
| @@ -41,7 +41,14 @@ namespace FarmmapsApi.Services | ||||
|         { | ||||
|             var startUpload = DateTime.UtcNow.AddSeconds(-3); | ||||
|             var result = await _farmmapsApiService.UploadFile(filePath, root.Code, geoJsonString, | ||||
|                 progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}")); | ||||
|                 progress => | ||||
|                 { | ||||
|                     _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"); | ||||
|                      | ||||
|                     if(progress.Status == UploadStatus.Failed && progress.Exception != null) | ||||
|                         _logger.LogError(progress.Exception.Message ?? "No further error"); | ||||
|                      | ||||
|                 }); | ||||
|  | ||||
|             if (result.Progress.Status == UploadStatus.Failed) | ||||
|                 return null; | ||||
| @@ -68,13 +75,16 @@ namespace FarmmapsApi.Services | ||||
|         public async Task<Item> ShapeToGeotiff(Item shapeItem, int resolution = 1, params string[] inputLayerNames) | ||||
|         { | ||||
|             var startUpload = DateTime.UtcNow.AddSeconds(-3); | ||||
|             await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff", request => | ||||
|             var taskStatus = await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff", request => | ||||
|             { | ||||
|                 request.attributes["resolution"] = resolution.ToString(); | ||||
|                 if(inputLayerNames.Length > 0) | ||||
|                     request.attributes["inputLayers"] = $"[{string.Join(",", inputLayerNames.Select(v => $"\"{v}\""))}]"; | ||||
|             }); | ||||
|  | ||||
|             if (taskStatus.State == ItemTaskState.Error) | ||||
|                 return null; | ||||
|  | ||||
|             return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name, | ||||
|                 i => i.Created >= startUpload && | ||||
|                      i.Name.ToLower().Contains(shapeItem.Name.ToLower())); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user