Skip to content

Commit

Permalink
RavenDB-23534 - fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha-kotler committed Feb 11, 2025
1 parent 198c60b commit ea8bce4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public sealed class DatabaseNotificationStorage(ServerStore serverStore, string
protected override void CreateSchema()
{
var command = new InitializeSchemaForNotificationsCommand(TableName);
serverStore.Engine.TxMerger.EnqueueSync(command);
ServerStore.Engine.TxMerger.EnqueueSync(command);
}
}
22 changes: 12 additions & 10 deletions src/Raven.Server/NotificationCenter/NotificationsStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ namespace Raven.Server.NotificationCenter
{
public abstract unsafe class NotificationsStorage(ServerStore serverStore, string resourceName = null)
{
protected readonly ServerStore ServerStore = serverStore;

protected readonly string TableName = GetTableName(resourceName);

private readonly Logger Logger = LoggingSource.Instance.GetLogger<NotificationsStorage>(resourceName);
private readonly Logger _logger = LoggingSource.Instance.GetLogger<NotificationsStorage>(resourceName);

protected StorageEnvironment Environment;

Expand Down Expand Up @@ -75,13 +77,13 @@ public bool Store(Notification notification, DateTime? postponeUntil = null, boo
}
}

if (Logger.IsInfoEnabled)
Logger.Info($"Saving notification '{notification.Id}'.");
if (_logger.IsInfoEnabled)
_logger.Info($"Saving notification '{notification.Id}'.");

using (var json = context.ReadObject(notification.ToJson(), "notification", BlittableJsonDocumentBuilder.UsageMode.ToDisk))
{
var command = new StoreNotificationCommand(context.GetLazyString(notification.Id), notification.CreatedAt, postponeUntil, json, this);
serverStore.Engine.TxMerger.EnqueueSync(command);
ServerStore.Engine.TxMerger.EnqueueSync(command);
}
}

Expand Down Expand Up @@ -235,12 +237,12 @@ public bool Delete(string id, RavenTransaction existingTransaction = null)
else
{
var command = new DeleteNotificationCommand(id, this);
serverStore.Engine.TxMerger.EnqueueSync(command);
ServerStore.Engine.TxMerger.EnqueueSync(command);
deleteResult = command.Deleted;
}

if (deleteResult && Logger.IsInfoEnabled)
Logger.Info($"Deleted notification '{id}'.");
if (deleteResult && _logger.IsInfoEnabled)
_logger.Info($"Deleted notification '{id}'.");
return deleteResult;
}

Expand Down Expand Up @@ -353,7 +355,7 @@ public void ChangePostponeDate(string id, DateTime? postponeUntil)
Memory.Copy(itemCopy.Address, item.Json.BasePointer, item.Json.Size);

var command = new StoreNotificationCommand(context.GetLazyString(id), item.CreatedAt, postponeUntil, new BlittableJsonReaderObject(itemCopy.Address, item.Json.Size, context), this);
serverStore.Engine.TxMerger.EnqueueSync(command);
ServerStore.Engine.TxMerger.EnqueueSync(command);
}
}
}
Expand Down Expand Up @@ -427,7 +429,7 @@ public DatabaseNotificationStorage GetStorageFor(string database)
if (database == null)
throw new ArgumentNullException(nameof(database));

var storage = new DatabaseNotificationStorage(serverStore, database);
var storage = new DatabaseNotificationStorage(ServerStore, database);
storage.Initialize(Environment, ContextPool);

return storage;
Expand All @@ -440,7 +442,7 @@ public void DeleteStorageFor(string database)

var tableName = GetTableName(database);
var command = new DeleteTableForNotificationsCommand(tableName);
serverStore.Engine.TxMerger.EnqueueSync(command);
ServerStore.Engine.TxMerger.EnqueueSync(command);
}

public void DeleteStorageFor<T>(TransactionOperationContext<T> ctx, string database) where T : RavenTransaction
Expand Down

0 comments on commit ea8bce4

Please sign in to comment.