Changed various locking mechanism.
This commit is contained in:
@@ -30,7 +30,8 @@ namespace HermesSocketServer.Store
|
||||
await _database.Execute(sql, data, (reader) =>
|
||||
{
|
||||
var chatterId = reader.GetInt32(0).ToString();
|
||||
lock (_lock)
|
||||
_rwls.EnterWriteLock();
|
||||
try
|
||||
{
|
||||
_store.Add(chatterId, new GroupChatter()
|
||||
{
|
||||
@@ -40,6 +41,10 @@ namespace HermesSocketServer.Store
|
||||
ChatterLabel = reader.GetString(1),
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
_rwls.ExitWriteLock();
|
||||
}
|
||||
});
|
||||
_logger.Information($"Loaded {_store.Count} group chatters from database [group id: {_groupId}]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user