diff --git a/src/providers/WorkflowCore.Providers.Redis/Services/RedisPersistenceProvider.cs b/src/providers/WorkflowCore.Providers.Redis/Services/RedisPersistenceProvider.cs index 6bf8df875..b5702a571 100644 --- a/src/providers/WorkflowCore.Providers.Redis/Services/RedisPersistenceProvider.cs +++ b/src/providers/WorkflowCore.Providers.Redis/Services/RedisPersistenceProvider.cs @@ -182,8 +182,13 @@ public async Task CreateEvent(Event newEvent, CancellationToken _ = defa await _redis.HashSetAsync($"{_prefix}.{EVENT_SET}", newEvent.Id, str); await _redis.SortedSetAddAsync($"{_prefix}.{EVENT_SET}.{EVENTSLUG_INDEX}.{newEvent.EventName}-{newEvent.EventKey}", newEvent.Id, newEvent.EventTime.Ticks); - if (newEvent.IsProcessed) + if (newEvent.IsProcessed){ await _redis.SortedSetRemoveAsync($"{_prefix}.{EVENT_SET}.{RUNNABLE_INDEX}", newEvent.Id); + + if (_removeComplete){ + await _redis.SortedSetRemoveAsync($"{_prefix}.{EVENT_SET}", newEvent.Id); + } + } else await _redis.SortedSetAddAsync($"{_prefix}.{EVENT_SET}.{RUNNABLE_INDEX}", newEvent.Id, newEvent.EventTime.Ticks); @@ -225,6 +230,9 @@ public async Task MarkEventProcessed(string id, CancellationToken cancellationTo var str = JsonConvert.SerializeObject(evt, _serializerSettings); await _redis.HashSetAsync($"{_prefix}.{EVENT_SET}", evt.Id, str); await _redis.SortedSetRemoveAsync($"{_prefix}.{EVENT_SET}.{RUNNABLE_INDEX}", id); + if (_removeComplete){ + await _redis.SortedSetRemoveAsync($"{_prefix}.{EVENT_SET}", id); + } } public async Task MarkEventUnprocessed(string id, CancellationToken cancellationToken = default)