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 摘要。