diff --git a/Store/ChatterStore.cs b/Store/ChatterStore.cs index ca27a4a..f98ffbc 100644 --- a/Store/ChatterStore.cs +++ b/Store/ChatterStore.cs @@ -69,7 +69,7 @@ namespace HermesSocketServer.Store _added.Clear(); } - _logger.Debug($"ADD {count} " + sql); + _logger.Debug($"TtsChatVoice - Adding {count} rows to database: {sql}"); await _database.ExecuteScalar(sql); } if (_modified.Any()) @@ -80,7 +80,7 @@ namespace HermesSocketServer.Store sql = _generator.GenerateUpdateSql("TtsChatVoice", _modified.Select(m => _store[m]), ["userId", "chatterId"], ["ttsVoiceId"]); _modified.Clear(); } - _logger.Debug($"MOD {count} " + sql); + _logger.Debug($"TtsChatVoice - Modifying {count} rows in database: {sql}"); await _database.ExecuteScalar(sql); } if (_deleted.Any()) @@ -91,7 +91,7 @@ namespace HermesSocketServer.Store sql = _generator.GenerateDeleteSql("TtsChatVoice", _deleted, ["userId", "chatterId"]); _deleted.Clear(); } - _logger.Debug($"DEL {count} " + sql); + _logger.Debug($"TtsChatVoice - Deleting {count} rows from database: {sql}"); await _database.ExecuteScalar(sql); } return true; diff --git a/Store/UserStore.cs b/Store/UserStore.cs index cdae3bb..029434d 100644 --- a/Store/UserStore.cs +++ b/Store/UserStore.cs @@ -58,34 +58,40 @@ namespace HermesSocketServer.Store public override async Task Save() { + int count = 0; + string sql = string.Empty; + if (_added.Any()) { - string sql = string.Empty; lock (_lock) { + count = _added.Count; sql = _generator.GenerateInsertSql("User", _added.Select(a => _store[a]), ["id", "name", "email", "role", "ttsDefaultVoice"]); _added.Clear(); } + _logger.Debug($"User - Adding {count} rows to database: {sql}"); await _database.ExecuteScalar(sql); } if (_modified.Any()) { - string sql = string.Empty; lock (_lock) { + count = _modified.Count; sql = _generator.GenerateUpdateSql("User", _modified.Select(m => _store[m]), ["id"], ["name", "email", "role", "ttsDefaultVoice"]); _modified.Clear(); } + _logger.Debug($"User - Modifying {count} rows in database: {sql}"); await _database.ExecuteScalar(sql); } if (_deleted.Any()) { - string sql = string.Empty; lock (_lock) { + count = _deleted.Count; sql = _generator.GenerateDeleteSql("User", _deleted, ["id"]); _deleted.Clear(); } + _logger.Debug($"User - Deleting {count} rows from database: {sql}"); await _database.ExecuteScalar(sql); } return true; diff --git a/Store/VoiceStore.cs b/Store/VoiceStore.cs index e37ae13..d9bc048 100644 --- a/Store/VoiceStore.cs +++ b/Store/VoiceStore.cs @@ -72,7 +72,7 @@ namespace HermesSocketServer.Store _added.Clear(); } - _logger.Debug($"ADD {count} " + sql); + _logger.Debug($"TtsVoice - Adding {count} rows to database: {sql}"); await _database.ExecuteScalar(sql); } if (_modified.Any()) @@ -83,7 +83,7 @@ namespace HermesSocketServer.Store sql = _generator.GenerateUpdateSql("TtsVoice", _modified.Select(m => _store[m]), ["id"], ["name"]); _modified.Clear(); } - _logger.Debug($"MOD {count} " + sql); + _logger.Debug($"TtsVoice - Modifying {count} rows in database: {sql}"); await _database.ExecuteScalar(sql); } if (_deleted.Any()) @@ -94,7 +94,7 @@ namespace HermesSocketServer.Store sql = _generator.GenerateDeleteSql("TtsVoice", _deleted, ["id"]); _deleted.Clear(); } - _logger.Debug($"DEL {count} " + sql); + _logger.Debug($"TtsVoice - Deleting {count} rows from database: {sql}"); await _database.ExecuteScalar(sql); } return true;