startup hang solved
All checks were successful
gitea.arg.rip/vassago/pipeline/head This commit looks good

🎉
This commit is contained in:
adam 2025-04-24 10:58:01 -04:00
parent 2d50a75f2e
commit e85a61607e
3 changed files with 6 additions and 7 deletions

View File

@ -65,8 +65,7 @@ public class Behaver
internal bool IsSelf(Guid AccountId)
{
var db = new ChattingContext();
var acc = db.Accounts.Find(AccountId);
var acc = Rememberer.SearchAccount(a => a.Id == AccountId);
return SelfAccounts.Any(acc => acc.Id == AccountId);
}

View File

@ -143,7 +143,7 @@ public class TwitchInterface
private Account UpsertAccount(string username, Channel inChannel)
{
Console.WriteLine($"upserting twitch account. username: {username}. inChannel: {inChannel?.Id}");
var acc = Rememberer.SearchAccount(ui => ui.ExternalId == username && ui.SeenInChannel.ExternalId == inChannel.ExternalId.ToString());
var acc = Rememberer.SearchAccount(ui => ui.ExternalId == username && ui.SeenInChannel.ExternalId == inChannel.ExternalId);
Console.WriteLine($"upserting twitch account, retrieved {acc?.Id}.");
if (acc != null)
{
@ -205,7 +205,7 @@ public class TwitchInterface
c.SendFile = (f, t) => { throw new InvalidOperationException($"twitch cannot send files"); };
c = Rememberer.RememberChannel(c);
var selfAccountInChannel = c.Users?.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId.ToString());
var selfAccountInChannel = c.Users?.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId);
if(selfAccountInChannel == null)
{
selfAccountInChannel = UpsertAccount(selfAccountInProtocol.Username, c);
@ -248,7 +248,7 @@ Channel c = Rememberer.SearchChannel(ci => ci.ExternalId == $"w_{whisperWith}"
c.SendFile = (f, t) => { throw new InvalidOperationException($"twitch cannot send files"); };
c = Rememberer.RememberChannel(c);
var selfAccountInChannel = c.Users.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId.ToString());
var selfAccountInChannel = c.Users.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId);
if(selfAccountInChannel == null)
{
selfAccountInChannel = UpsertAccount(selfAccountInChannel.Username, c);

View File

@ -13,7 +13,7 @@ public static class Rememberer
{
Account toReturn;
dbAccessSemaphore.Wait();
toReturn = db.Accounts.Include(a => a.IsUser).FirstOrDefault(predicate);
toReturn = db.Accounts?.Include(a => a.IsUser)?.FirstOrDefault(predicate);
dbAccessSemaphore.Release();
return toReturn;
}
@ -110,7 +110,7 @@ public static class Rememberer
dbAccessSemaphore.Wait();
db.Accounts.Remove(toForget);
db.SaveChanges();
dbAccessSemaphore.Release();
dbAccessSemaphore.Release();
}
}
public static void ForgetChannel(Channel toForget)