wavesplatform / wavesplatform/nodemon
[FEATURE] Add time span window for service start
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8
- Forks
- 0
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 7
Description
Аbstract
Nodemon should have an option which can control time span window for service start.
Motivation and Purposes
For now nodemon starts instantly though network may be in inconsistent state which can lead to monitoring false positive alerts and warnings.
Specification
The main idea is to delay service start till, for example, 80% of provided scraping timeout. time.Now() should be rounded up to scraping timeout and then subbed by time.Now(). If the result is lower than, for example 0.8 * scrapingTimeout , then we should delay service start till 0.8 * scrapingTimeout - result.
Backwards Compatibility
Nope, the changing is fully compatible.
Examples and Implementation
var interval time.Duration
flag.DurationVar(&interval, "interval", 60*time.Second, "Polling interval, seconds. Default value is 60")
flag.Parse()
ctx, done := signal.NotifyContext(context.Background(), os.Interrupt)
defer done()
var (
now = time.Now()
windowUpperBoundary = interval
windowLowerBoundary = interval * 4 / 5
)
if spanPoint := now.Truncate(windowUpperBoundary).Add(windowUpperBoundary).Sub(now); spanPoint < windowLowerBoundary {
delayTime := windowLowerBoundary - spanPoint
select {
case <-time.After(delayTime):
case <-ctx.Done():
return nil
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Go service-start path and the existing polling interval flag described in the issue. Done means startup is delayed according to the specified 80%-of-interval window, remains interruptible through the shown context, and preserves backward compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100