Skip to content

The TTL keeps resetting instead of expiring the key #116

@MatheusTheBot

Description

@MatheusTheBot

Expected Behavior: After creating a new key with TTL, said key would be disposed without needing to call RedLockfactory.Dispose();

Current Behavior: After creating a new key with TTL, said key resets its TTL before getting expired and if manually deleted from the database with Redis Insights, the same key is not deleted and appears again after few seconds. This behavior keeps until my application is finished.

Here is a simple working example of the issue

Image

Image

Image

Image

When i try creating a new key on redis, it successfully does, but does said key does not expire when it reach its TTL, instead it resets the key's TTL to its original value and keeps that way until i finish the application.

What i have tried:

  • Doing a new request does not seems to work
  • Setting RedisService to Scoped also does not help, even though in theory after a request, the instance would be destroyed and so would be the RedLockFactory property
  • Adding a deconstructor calling RedLockFactory.Dispose() on RedisService also does not work
  • If I try call redLock.Dispose() on TestRegister(), it does work, but the key is instantly deleted from the database

I'm creating this issue to be sure that this is the intended behavior and how should i proceed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions