apevolo-api icon indicating copy to clipboard operation
apevolo-api copied to clipboard

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

Open huster-songtao opened this issue 2 years ago • 1 comments

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 avatar Apr 03 '22 15:04 huster-songtao

//线程
            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 可以去掉

huster-songtao avatar Apr 03 '22 15:04 huster-songtao