xianhc / apevolo-api

.Net 8 、SqlSugar ORM、Vue 2.X、RBAC、前后端分离的开箱则用的企业级中后台权限管理系统
https://www.apevolo.com
Apache License 2.0
809 stars 74 forks source link

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

Closed huster-songtao closed 12 months ago

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

这里的async需要去掉

huster-songtao commented 2 years ago
//线程
            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 可以去掉