Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

HeartbeatPlugin ignores heartbeat intervals with a seconds component under 30 (uses TimeSpan.Seconds instead of TotalSeconds)

未关闭 适合新手
#387 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
backend

调研方向

阅读 src/Exceptionless/Plugins/Default/100_HeartbeatPlugin.cs,重点查看第 16–18 行的间隔验证;issue 指出了错误的 TimeSpan.Seconds 检查,并建议比较总秒数或一个 TimeSpan。检查 src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs 中 UseSessions 的传递,并添加或查找一个针对小于和大于 30 秒间隔的测试。完成标准是保留 30 秒或更长的间隔,而较短的间隔使用一分钟的默认值。

由索引模型根据 Issue 内容生成。

描述

bug

In Exceptionless 6.2.0 (core Exceptionless package), HeartbeatPlugin validates the configured interval with interval.Value.Seconds >= 30. TimeSpan.Seconds is only the 0-59 seconds component, so most whole-minute intervals are rejected and silently replaced with the 1 minute default.

Where

What happens

Requested interval .Seconds Interval used
TimeSpan.FromSeconds(45) 45 45 seconds
TimeSpan.FromSeconds(90) 30 90 seconds
TimeSpan.FromSeconds(75) 15 1 minute
TimeSpan.FromMinutes(2) 0 1 minute
TimeSpan.FromMinutes(5) 0 1 minute

Any interval that is a whole number of minutes falls back to 1 minute, so config.UseSessions(heartbeatInterval: TimeSpan.FromMinutes(5)) sends heartbeats every minute instead of every 5 minutes.

Expected

Intervals of 30 seconds or more are honored; only intervals under 30 seconds fall back to the default.

With the 6.2.0 package, new HeartbeatPlugin(TimeSpan.FromMinutes(5)) stores an interval of 00:01:00, while new HeartbeatPlugin(TimeSpan.FromSeconds(90)) stores 00:01:30.

Steps to reproduce

  1. config.UseSessions(heartbeatInterval: TimeSpan.FromMinutes(5));
  2. Set a user identity and submit an event to start a session.
  3. Session heartbeat events are sent every minute, not every 5 minutes.

Suggested fix

Use interval.Value.TotalSeconds >= 30 (or interval.Value >= TimeSpan.FromSeconds(30)).

主要语言
C#
星标
573
派生
143
平均合并
5 天 9 小时
30 天内合并 PR
1

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

exceptionless/Exceptionless.Net 的其他 Issue

查看 exceptionless/Exceptionless.Net 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。