CrazyIter_Bin 2 年之前
父节点
当前提交
a61f404f11

+ 3 - 1
TEAMModelOS.FunctionV4/ServiceBus/ServiceBusSub.cs

@@ -88,7 +88,9 @@ namespace TEAMModelOS.FunctionV4
                     blobsize = blobsize + score.Score;
                 }
             }
-            await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", new RedisValue(name), new RedisValue($"{blobsize}"));
+            if (blobsize > 0) {
+                await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", new RedisValue(name), new RedisValue($"{blobsize}"));
+            }
             long end = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             long dis = (end - statr) / 1000;
             long timeout = 60 * 5;

+ 9 - 2
TEAMModelOS/Controllers/System/BlobController.cs

@@ -266,7 +266,11 @@ namespace TEAMModelOS.Controllers
                 {
                     var client = _azureStorage.GetBlobContainerClient(name);
                     var size = await client.GetBlobsCatalogSize();
-                    await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, size.Item1);
+                    if (size.Item1 > 0)
+                    {
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, size.Item1);
+                    }
+                   
                     foreach (var key in size.Item2.Keys)
                     {
                         await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{name}", key);
@@ -289,7 +293,10 @@ namespace TEAMModelOS.Controllers
                 else {
                     var client = _azureStorage.GetBlobContainerClient(name);
                     var size = await client.GetBlobsCatalogSize();
-                    await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, size.Item1);
+                    if (size.Item1 > 0)
+                    {
+                        await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, size.Item1);
+                    }
                     foreach (var key in size.Item2.Keys)
                     {
                         await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{name}", key);