Created
December 27, 2017 12:12
-
-
Save reinaldocoelho/37e33d3b43983498154bc0139d57ff41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ESTE CODIGO RODA NORMALMENTE | |
public class SystemServices : WebService | |
{ | |
[WebMethod] | |
public void Teste() | |
{ | |
try | |
{ | |
var bucketName = $"2-attachment"; | |
var fileName = "2017/12/22/71024/d1efb329-f81d-401a-a55f-491fa1c71b07"; | |
var connectionData = ObjectStorage.GetConnectionTo(ObjectStorageType.ObjectStorage); | |
var minioClient = new MinioClient(connectionData.ObjectStorageEndpoint, connectionData.ObjectStorageAccessKey, connectionData.ObjectStorageSecretKey, connectionData.ObjectStorageRegion); | |
var client = new MinioStorage(minioClient); | |
var found = client.BucketExistsAsync(bucketName).Result; | |
if (!found) | |
{ | |
var makeTask = client.MakeBucketAsync(bucketName); | |
Task.WaitAll(makeTask); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine($"Erro ao tentar remover um Bucket. Erro:{e.Message}"); | |
} | |
} | |
} | |
// ESTE CODIGO A TASK FOUND NUNCA TERMINA | |
public class TesteController : Controller | |
{ | |
public void Teste() | |
{ | |
try | |
{ | |
var bucketName = $"2-attachment"; | |
var fileName = "2017/12/22/71024/d1efb329-f81d-401a-a55f-491fa1c71b07"; | |
var connectionData = ObjectStorage.GetConnectionTo(ObjectStorageType.ObjectStorage); | |
var minioClient = new MinioClient(connectionData.ObjectStorageEndpoint, connectionData.ObjectStorageAccessKey, connectionData.ObjectStorageSecretKey, connectionData.ObjectStorageRegion); | |
var client = new MinioStorage(minioClient); | |
var found = client.BucketExistsAsync(bucketName).Result; | |
if (!found) | |
{ | |
var makeTask = client.MakeBucketAsync(bucketName); | |
Task.WaitAll(makeTask); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine($"Erro ao tentar remover um Bucket. Erro:{e.Message}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment