fix comments
This commit is contained in:
parent
a2cae37963
commit
4a220ab2cd
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Core.Crontab.Functions;
|
||||
|
|
@ -22,12 +23,17 @@ public class TaskWaitFn : IFunctionCallback
|
|||
try
|
||||
{
|
||||
var args = JsonSerializer.Deserialize<TaskWaitArgs>(message.FunctionArgs);
|
||||
if (args != null || args.DelayTime > 0)
|
||||
if (args != null && args.DelayTime > 0)
|
||||
{
|
||||
await Task.Delay(args.DelayTime * 1000);
|
||||
}
|
||||
message.Content = "wait task completed";
|
||||
}
|
||||
catch (JsonException jsonEx)
|
||||
{
|
||||
message.Content = "Invalid function arguments format.";
|
||||
_logger.LogError(jsonEx, "Json deserialization failed.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message.Content = "Unable to perform delay task";
|
||||
|
|
|
|||
Loading…
Reference in a new issue