😎禁止任务队列异常重试及增加异常日志
This commit is contained in:
parent
3ab67698cd
commit
6bf29ebac8
@ -72,7 +72,17 @@ public class Startup : AppStartup
|
|||||||
// 远程请求
|
// 远程请求
|
||||||
services.AddHttpRemote();
|
services.AddHttpRemote();
|
||||||
// 任务队列
|
// 任务队列
|
||||||
services.AddTaskQueue();
|
services.AddTaskQueue(builder =>
|
||||||
|
{
|
||||||
|
builder.NumRetries = 0; // 默认重试 0 次
|
||||||
|
//builder.RetryTimeout = 1000; // 每次重试间隔 1000ms
|
||||||
|
|
||||||
|
// 订阅 TaskQueue 意外未捕获异常
|
||||||
|
builder.UnobservedTaskExceptionHandler = (obj, args) =>
|
||||||
|
{
|
||||||
|
Log.Error($"任务队列异常:{args.Exception?.Message}", args.Exception);
|
||||||
|
};
|
||||||
|
});
|
||||||
// 作业调度
|
// 作业调度
|
||||||
services.AddSchedule(options =>
|
services.AddSchedule(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user