Skip to content

Redis caching: Notification queue not suspended when background task queue is overloaded #2

@gfraiteur

Description

@gfraiteur

Title: Redis caching: Notification queue not suspended when background task queue is overloaded

Description

The RedisCacheDependencyGarbageCollector does not respond to IsBackgroundTaskQueueOverloadedChanged events by suspending the notification queue processing.

Current Behavior

When the background task scheduler becomes overloaded:

  • Individual notifications are skipped in ProcessKeyspaceNotification (the code checks IsBackgroundTaskQueueOverloaded and logs a warning)
  • However, the notification queue continues receiving notifications from Redis
  • This can cause memory buildup as notifications pile up in the BlockingCollection

Expected Behavior

When IsBackgroundTaskQueueOverloadedChanged fires and the queue is overloaded:

  • RedisNotificationQueue.SuspendProcessing() should be called to pause the processing thread
  • When the queue recovers, ResumeProcessing() should be called

The SuspendProcessing() and ResumeProcessing() methods already exist in RedisNotificationQueue but are not wired up to the overload event.

Affected Files

  • PostSharp.Patterns.Caching.Backends.Redis/RedisCacheDependencyGarbageCollector.cs
  • PostSharp.Patterns.Caching.Backends.Redis/RedisNotificationQueue.cs

Filed by Claude on behalf of the Metalama team while porting caching resilience features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions