mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 13:54:36 +00:00
Remove async multiple updates
This commit is contained in:
parent
3d3db6d5e1
commit
ffbffdd9b4
1 changed files with 2 additions and 4 deletions
|
@ -46,23 +46,21 @@ namespace BirthdayBot.BackgroundServices
|
|||
cUpdateGuildUser.Prepare();
|
||||
|
||||
// Do actual updates
|
||||
var updates = new List<Task>();
|
||||
foreach (var item in updateList)
|
||||
{
|
||||
var guild = item.Key;
|
||||
var userlist = item.Value;
|
||||
|
||||
pUpdateG.Value = (long)guild;
|
||||
updates.Add(cUpdateGuild.ExecuteNonQueryAsync());
|
||||
await cUpdateGuild.ExecuteNonQueryAsync();
|
||||
|
||||
pUpdateGU_g.Value = (long)guild;
|
||||
foreach (var userid in userlist)
|
||||
{
|
||||
pUpdateGU_u.Value = (long)userid;
|
||||
updates.Add(cUpdateGuildUser.ExecuteNonQueryAsync());
|
||||
await cUpdateGuildUser.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
await Task.WhenAll(updates);
|
||||
|
||||
// Delete all old values - expects referencing tables to have 'on delete cascade'
|
||||
using var t = db.BeginTransaction();
|
||||
|
|
Loading…
Reference in a new issue