This commit is contained in:
@@ -10,10 +10,12 @@ TODO: Ensure scaleability by checking for performance issues now before replicat
|
||||
|
||||
TODO: look for any line of code that does this or similar: await Task.CompletedTask, [anything].Result;
|
||||
- Needs to be turned into a true async function or not an async function
|
||||
|
||||
|
||||
TODO: Look at any of my middleware code as it's a HOT PATH, make sure it's async db access etc and nothing slowing it down
|
||||
|
||||
TODO: Any code at the server that access the db or does file IO MUST be async top to bottom!!
|
||||
- FileUtil may have a bunch of IO stuff
|
||||
|
||||
TODO: REFACTOR GetNoLogAsync function is used in many places redundantly when the logging version could do the same thing but not log it with an optional bool switch so refactor that shit
|
||||
TODO: REFACTOR biz objects have two creates, an async and sync one, WTF is that about? See if can make it just one async version.
|
||||
|
||||
@@ -422,7 +422,7 @@ namespace AyaNova
|
||||
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE)
|
||||
{
|
||||
_newLog.LogWarning("BOOT: AYANOVA_PERMANENTLY_ERASE_DATABASE is true, dropping and recreating database");
|
||||
Util.DbUtil.DropAndRecreateDb(_newLog);
|
||||
Util.DbUtil.DropAndRecreateDbAsync(_newLog);
|
||||
AySchema.CheckAndUpdate(dbContext, _newLog);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace AyaNova.Util
|
||||
// This is the NUCLEAR option and
|
||||
// completely ditches the DB and all user uploaded files
|
||||
//
|
||||
internal static void DropAndRecreateDb(ILogger _log)
|
||||
internal static async Task DropAndRecreateDbAsync(ILogger _log)
|
||||
{
|
||||
_log.LogInformation("Dropping and recreating Database \"{0}\"", _dbName);
|
||||
|
||||
@@ -227,20 +227,20 @@ namespace AyaNova.Util
|
||||
|
||||
using (var conn = new Npgsql.NpgsqlConnection(AdminConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
await conn.OpenAsync();
|
||||
|
||||
// Create the database desired
|
||||
using (var cmd = new Npgsql.NpgsqlCommand())
|
||||
{
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = "DROP DATABASE \"" + _dbName + "\";";
|
||||
cmd.ExecuteNonQuery();
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = "CREATE DATABASE \"" + _dbName + "\";";
|
||||
cmd.ExecuteNonQuery();
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
_log.LogInformation("Database re-created successfully!");
|
||||
}
|
||||
conn.Close();
|
||||
await conn.CloseAsync();
|
||||
}
|
||||
|
||||
//final cleanup step is to erase user uploaded files
|
||||
@@ -286,17 +286,17 @@ namespace AyaNova.Util
|
||||
|
||||
//REMOVE ALL DATA with few exceptions of manager user, license, schema tables
|
||||
//and job logs because this is called by job code
|
||||
EraseTableAsync("afileattachment", conn);
|
||||
EraseTableAsync("awidget", conn);
|
||||
EraseTableAsync("aevent", conn);
|
||||
EraseTableAsync("adatalistfilter", conn);
|
||||
EraseTableAsync("adatalisttemplate", conn);
|
||||
EraseTableAsync("aformcustom", conn);
|
||||
EraseTableAsync("asearchkey", conn);
|
||||
EraseTableAsync("asearchdictionary", conn);
|
||||
EraseTableAsync("atag", conn);
|
||||
await EraseTableAsync("afileattachment", conn);
|
||||
await EraseTableAsync("awidget", conn);
|
||||
await EraseTableAsync("aevent", conn);
|
||||
await EraseTableAsync("adatalistfilter", conn);
|
||||
await EraseTableAsync("adatalisttemplate", conn);
|
||||
await EraseTableAsync("aformcustom", conn);
|
||||
await EraseTableAsync("asearchkey", conn);
|
||||
await EraseTableAsync("asearchdictionary", conn);
|
||||
await EraseTableAsync("atag", conn);
|
||||
|
||||
conn.Close();
|
||||
await conn.CloseAsync();
|
||||
}
|
||||
|
||||
//If we got here then it's safe to erase the attachment files
|
||||
|
||||
Reference in New Issue
Block a user