xianhc / apevolo-api

.Net 8 、SqlSugar ORM、Vue 2.X、RBAC、前后端分离的开箱则用的企业级中后台权限管理系统

Home Page:https://www.apevolo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

\ApeVolo.Common\Caches\Redis\Service\MessageQueue\InitCore.cs

huster-songtao opened this issue · comments

await Task.Run(async () =>
                                    {
                                        if (parameterInfos.Length == 0)
                                        {
                                            consumerExecutorDescriptor.MethodInfo.Invoke(obj, null);
                                        }
                                        else
                                        {
                                            object[] parameters = { res };
                                            consumerExecutorDescriptor.MethodInfo.Invoke(obj, parameters);
                                        }
                                    });

这里的async需要去掉

//线程
            tasks.Add(Task.Run(async () =>
            {
                using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
                {

这里的async需要去掉

可以去掉{},改成
using var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope();

await Task.Run(async () =>
{
    if (parameterInfos.Length == 0)
    {
        consumerExecutorDescriptor.MethodInfo.Invoke(obj, null);
    }
    else
    {
        object[] parameters = { res };
        consumerExecutorDescriptor.MethodInfo.Invoke(obj, parameters);
    }
});

这里的async 可以去掉