|
@@ -160,10 +160,6 @@ namespace TEAMModelOS.FunctionV4
|
|
|
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
- //新增serviceBus 消息释放后处理table
|
|
|
- string pkey = string.Format("{0}{1}{2}", info.code, "-", "pending");
|
|
|
- await table.DeleteSingle<ChangeRecord>(pkey, data.id);
|
|
|
//向学生或醍摩豆账号发起通知
|
|
|
#region
|
|
|
//Notice notice = new Notice()
|
|
@@ -396,43 +392,45 @@ namespace TEAMModelOS.FunctionV4
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- // 发送信息通知
|
|
|
- var messageEnd = new ServiceBusMessage(new { id = data.id, progress = "finish", code = data.code }.ToJsonString());
|
|
|
- messageEnd.ApplicationProperties.Add("name", "Exam");
|
|
|
- if (records.Count > 0)
|
|
|
- {
|
|
|
- long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
|
|
|
- try
|
|
|
+ try {
|
|
|
+ //新增serviceBus 消息释放后处理table
|
|
|
+ string pkey = string.Format("{0}{1}{2}", info.code, "-", "pending");
|
|
|
+ await table.DeleteSingle<ChangeRecord>(pkey, data.id);
|
|
|
+ // 发送信息通知
|
|
|
+ var messageEnd = new ServiceBusMessage(new { id = data.id, progress = "finish", code = data.code }.ToJsonString());
|
|
|
+ messageEnd.ApplicationProperties.Add("name", "Exam");
|
|
|
+ if (records.Count > 0)
|
|
|
{
|
|
|
+ long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
|
|
|
+
|
|
|
await _serviceBus.GetServiceBusClient().CancelMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), records[0].sequenceNumber);
|
|
|
+
|
|
|
+ records[0].sequenceNumber = end;
|
|
|
+ await table.SaveOrUpdate<ChangeRecord>(records[0]);
|
|
|
+ //await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
|
|
|
}
|
|
|
- catch (Exception)
|
|
|
+ else
|
|
|
{
|
|
|
+ long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
|
|
|
+ //string pk = String.Format("{0}{1}{2}", info.code, "-", "going");
|
|
|
+ ChangeRecord changeRecord = new ChangeRecord
|
|
|
+ {
|
|
|
+ RowKey = data.id,
|
|
|
+ PartitionKey = PartitionKey,
|
|
|
+ sequenceNumber = end,
|
|
|
+ msgId = messageEnd.MessageId
|
|
|
+ };
|
|
|
+ await table.Save<ChangeRecord>(changeRecord);
|
|
|
+ //await client.GetContainer(Constant.TEAMModelOS, "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
|
|
|
}
|
|
|
- records[0].sequenceNumber = end;
|
|
|
- await table.SaveOrUpdate<ChangeRecord>(records[0]);
|
|
|
- //await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(record, record.id, new Azure.Cosmos.PartitionKey($"{record.code}"));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
|
|
|
- //string pk = String.Format("{0}{1}{2}", info.code, "-", "going");
|
|
|
- ChangeRecord changeRecord = new ChangeRecord
|
|
|
- {
|
|
|
- RowKey = data.id,
|
|
|
- PartitionKey = PartitionKey,
|
|
|
- sequenceNumber = end,
|
|
|
- msgId = messageEnd.MessageId
|
|
|
- };
|
|
|
- await table.Save<ChangeRecord>(changeRecord);
|
|
|
- //await client.GetContainer(Constant.TEAMModelOS, "Common").CreateItemAsync(changeRecord, new Azure.Cosmos.PartitionKey($"{changeRecord.code}"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-{info.id}-ChangeRecord{e.Message}\n{e.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case "finish":
|
|
|
- //新增serviceBus 消息释放后处理table
|
|
|
- string pk = string.Format("{0}{1}{2}", info.code, "-", "going");
|
|
|
- await table.DeleteSingle<ChangeRecord>(pk, data.id);
|
|
|
+
|
|
|
int fno = 0;
|
|
|
try
|
|
|
{
|
|
@@ -553,6 +551,11 @@ namespace TEAMModelOS.FunctionV4
|
|
|
{
|
|
|
await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-{info.id}-评测finish状态异常{e.Message}\n{e.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
|
|
|
}
|
|
|
+ finally {
|
|
|
+ //新增serviceBus 消息释放后处理table
|
|
|
+ string pk = string.Format("{0}{1}{2}", info.code, "-", "going");
|
|
|
+ await table.DeleteSingle<ChangeRecord>(pk, data.id);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|