refactor(auth): 优化续期阈值配置逻辑

- 将固定1小时续期阈值改为动态计算方式
- 使用Token过期时间的20%作为续期阈值
- 避免过于频繁的续期操作
- 提高续期策略的灵活性和可维护性
This commit is contained in:
hjhan
2026-02-09 15:37:47 +08:00
parent 944c0a0e0d
commit 6c6115fef2
@@ -16,7 +16,8 @@ namespace YLErp.Web.Middleware
public class RefreshTokenMiddleware
{
private readonly RequestDelegate _next;
private const int RefreshThreshold = 3600; // 1小时阈值
// 续期阈值设为Token过期时间的20%,避免过于频繁的续期
private static int RefreshThreshold => (int)(AuthHelper.ExpireInSeconds * 0.2);
/// <summary>
/// 构造函数