|
@@ -61,7 +61,6 @@ if TYPE_CHECKING:
|
|
|
|
|
|
Delta = Dict[str, Any]
|
|
Delta = Dict[str, Any]
|
|
var = computed_var
|
|
var = computed_var
|
|
-config = get_config()
|
|
|
|
|
|
|
|
|
|
|
|
# If the state is this large, it's considered a performance issue.
|
|
# If the state is this large, it's considered a performance issue.
|
|
@@ -2319,6 +2318,24 @@ def _dill_reduce_state(pickler, obj):
|
|
dill.Pickler.dispatch[type](pickler, obj)
|
|
dill.Pickler.dispatch[type](pickler, obj)
|
|
|
|
|
|
|
|
|
|
|
|
+def _default_lock_expiration() -> int:
|
|
|
|
+ """Get the default lock expiration time.
|
|
|
|
+
|
|
|
|
+ Returns:
|
|
|
|
+ The default lock expiration time.
|
|
|
|
+ """
|
|
|
|
+ return get_config().redis_lock_expiration
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def _default_token_expiration() -> int:
|
|
|
|
+ """Get the default token expiration time.
|
|
|
|
+
|
|
|
|
+ Returns:
|
|
|
|
+ The default token expiration time.
|
|
|
|
+ """
|
|
|
|
+ return get_config().redis_token_expiration
|
|
|
|
+
|
|
|
|
+
|
|
class StateManagerRedis(StateManager):
|
|
class StateManagerRedis(StateManager):
|
|
"""A state manager that stores states in redis."""
|
|
"""A state manager that stores states in redis."""
|
|
|
|
|
|
@@ -2326,10 +2343,10 @@ class StateManagerRedis(StateManager):
|
|
redis: Redis
|
|
redis: Redis
|
|
|
|
|
|
# The token expiration time (s).
|
|
# The token expiration time (s).
|
|
- token_expiration: int = config.redis_token_expiration
|
|
|
|
|
|
+ token_expiration: int = pydantic.Field(default_factory=_default_token_expiration)
|
|
|
|
|
|
# The maximum time to hold a lock (ms).
|
|
# The maximum time to hold a lock (ms).
|
|
- lock_expiration: int = config.redis_lock_expiration
|
|
|
|
|
|
+ lock_expiration: int = pydantic.Field(default_factory=_default_lock_expiration)
|
|
|
|
|
|
# The keyspace subscription string when redis is waiting for lock to be released
|
|
# The keyspace subscription string when redis is waiting for lock to be released
|
|
_redis_notify_keyspace_events: str = (
|
|
_redis_notify_keyspace_events: str = (
|