|
@@ -6,6 +6,7 @@ using Azure.Cosmos;
|
|
|
using Microsoft.Azure.WebJobs;
|
|
|
using Microsoft.Azure.WebJobs.Host;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
+using StackExchange.Redis;
|
|
|
using TEAMModelOS.SDK.DI;
|
|
|
using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Models;
|
|
@@ -146,14 +147,22 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
[FunctionName("Blob")]
|
|
|
public async Task Blob([ServiceBusTrigger("active-task", "blob", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
|
|
|
- await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{msg}更新大小:",
|
|
|
- GroupNames.醍摩豆服務運維群組);
|
|
|
- var jsonMsg = JsonDocument.Parse(msg);
|
|
|
- jsonMsg.RootElement.TryGetProperty("code", out JsonElement name);
|
|
|
- var client = _azureStorage.GetBlobContainerClient($"{name}");
|
|
|
- var size = await client.GetBlobsSize();
|
|
|
- await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name.GetString(), size);
|
|
|
- await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{name}更新大小:{size}", GroupNames.醍摩豆服務運維群組);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"ServiceBus,Blob(){msg}", GroupNames.醍摩豆服務運維群組);
|
|
|
+ var jsonMsg = JsonDocument.Parse(msg);
|
|
|
+ jsonMsg.RootElement.TryGetProperty("code", out JsonElement name);
|
|
|
+ var client = _azureStorage.GetBlobContainerClient($"{name}");
|
|
|
+ var size = await client.GetBlobsSize();
|
|
|
+ await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{name}更新大小:{size}",
|
|
|
+ GroupNames.醍摩豆服務運維群組);
|
|
|
+ await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record",new RedisValue($"{name}"),new RedisValue($"{long.Parse($"{size}")}"));
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"ServiceBus,Blob()\n{ex.Message}{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|