tomo-kn / goalarm-cli

CLI with simple alarm functionality built in Go language
MIT License
0 stars 0 forks source link

[Bug] Potential Delay in Alarm Triggering Using `time.Sleep` #2

Open tomo-kn opened 10 months ago

tomo-kn commented 10 months ago

Issue Overview

We have noticed that in some instances, the alarm in our goalarm application triggers slightly later than the set time. While this is not a consistent issue, it has been observed intermittently.

Current Implementation

The application currently utilizes time.Sleep to wait until the scheduled alarm time. This approach generally works well, but the observed delays suggest there might be room for improvement.

Potential Cause

It is hypothesized that the precision of time.Sleep could be a contributing factor to these delays, especially under certain system conditions or resource constraints.

Proposed Exploration

As a potential solution, it might be worth exploring the use of time.Ticker instead of time.Sleep. time.Ticker offers a more granular approach to time management, which could potentially provide more accurate alarm triggering.

Intended Investigation

The aim is to investigate whether replacing time.Sleep with time.Ticker can reduce or eliminate the observed delays. This change might offer a more reliable way to ensure the alarm triggers exactly at the scheduled time.

Note

This issue is being logged as a potential enhancement based on observed behavior. Further investigation and testing are required to confirm if time.Ticker is a viable and more effective alternative.

tomo-kn commented 10 months ago

4 minutes delay

スクリーンショット 2024-01-29 13 35 14
tomo-kn commented 10 months ago

14 minutes delay

スクリーンショット 2024-02-01 14 11 20