fix(api): never cache anchor=latest windows as immutable [CI]
This commit is contained in:
1 parent
fb9dc155f5
commit
b33e50696d
2 files changed
+8
-1
No files matched your search
@@ -32,7 +32,10 @@ internal static class QueryHelpers
|
||||
/// </summary>
|
||||
public static IResult? ApplyCaching(HttpContext http, QueryRange range, long nowMs, string material)
|
||||
{
|
||||
bool closed = !range.IsRelative && range.RequestedToMs < nowMs - (2 * Steps.Minute);
|
||||
// anchor=latest 的相对时间段会被换成以“最后一个样本”为终点的绝对区间:线路停过一阵再恢复时,同一个地址的内容就会变,
|
||||
// 不能当成“已经结束的区间”永久缓存(浏览器会把某一刻的旧数据一直留着,页面上就是线路条不更新)。
|
||||
bool anchored = string.Equals(http.Request.Query["anchor"], "latest", StringComparison.OrdinalIgnoreCase);
|
||||
bool closed = !anchored && !range.IsRelative && range.RequestedToMs < nowMs - (2 * Steps.Minute);
|
||||
if (!closed)
|
||||
{
|
||||
http.Response.Headers.CacheControl = "no-store";
|
||||
|
||||
Reference in new issue
Block a user