mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21: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();
|
cUpdateGuildUser.Prepare();
|
||||||
|
|
||||||
// Do actual updates
|
// Do actual updates
|
||||||
var updates = new List<Task>();
|
|
||||||
foreach (var item in updateList)
|
foreach (var item in updateList)
|
||||||
{
|
{
|
||||||
var guild = item.Key;
|
var guild = item.Key;
|
||||||
var userlist = item.Value;
|
var userlist = item.Value;
|
||||||
|
|
||||||
pUpdateG.Value = (long)guild;
|
pUpdateG.Value = (long)guild;
|
||||||
updates.Add(cUpdateGuild.ExecuteNonQueryAsync());
|
await cUpdateGuild.ExecuteNonQueryAsync();
|
||||||
|
|
||||||
pUpdateGU_g.Value = (long)guild;
|
pUpdateGU_g.Value = (long)guild;
|
||||||
foreach (var userid in userlist)
|
foreach (var userid in userlist)
|
||||||
{
|
{
|
||||||
pUpdateGU_u.Value = (long)userid;
|
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'
|
// Delete all old values - expects referencing tables to have 'on delete cascade'
|
||||||
using var t = db.BeginTransaction();
|
using var t = db.BeginTransaction();
|
||||||
|
|
Loading…
Reference in a new issue