Skip to content

Commit

Permalink
feat parallel post
Browse files Browse the repository at this point in the history
  • Loading branch information
sun128764 committed Nov 21, 2023
1 parent 18ccd50 commit 6c8efc7
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions OKP.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,33 @@ private static void SinglePublish(string file, string settingFile, string? cooki
}
Log.Information("登录成功,继续发布?");
IOHelper.ReadLine();
foreach (var result in adapterList.Select(item => item.PostAsync().Result))
if(allowSkip)
{
if (result.IsSuccess)
Parallel.ForEach(adapterList, p =>
{
Log.Information("发布成功");
}
else
var res = p.PostAsync().Result;
if (res.IsSuccess)
{
Log.Information("发布成功");
}
else
{
Log.Error("发布失败");
}
});
}
else
{
foreach (var result in adapterList.Select(item => item.PostAsync().Result))
{
Log.Error("发布失败");
if (result.IsSuccess)
{
Log.Information("发布成功");
}
else
{
Log.Error("发布失败");
}
}
}
Log.Information("发布完成");
Expand Down

0 comments on commit 6c8efc7

Please sign in to comment.