Projects
Eulaceura:Mainline
etcd
_service:obs_scm:0011-backport-Fix-wait-time-do...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0011-backport-Fix-wait-time-docs-tests-to-indicate-trigger-deadline.patch of Package etcd
From 5f782c350f84f3f0e1386cb2d539a509a41336f7 Mon Sep 17 00:00:00 2001 From: redwrasse <mail@redwrasse.io> Date: Sat, 27 Jul 2024 21:41:40 +0000 Subject: [PATCH] fix wait_time docs, tests for trigger deadline greater than or equal to wait deadline Signed-off-by: redwrasse <mail@redwrasse.io> --- pkg/wait/wait_time.go | 4 ++-- pkg/wait/wait_time_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/wait/wait_time.go b/pkg/wait/wait_time.go index 297e48a..1317889 100644 --- a/pkg/wait/wait_time.go +++ b/pkg/wait/wait_time.go @@ -19,9 +19,9 @@ import "sync" type WaitTime interface { // Wait returns a chan that waits on the given logical deadline. // The chan will be triggered when Trigger is called with a - // deadline that is later than the one it is waiting for. + // deadline that is later than or equal to the one it is waiting for. Wait(deadline uint64) <-chan struct{} - // Trigger triggers all the waiting chans with an earlier logical deadline. + // Trigger triggers all the waiting chans with an equal or earlier logical deadline. Trigger(deadline uint64) } diff --git a/pkg/wait/wait_time_test.go b/pkg/wait/wait_time_test.go index 26164c4..2047558 100644 --- a/pkg/wait/wait_time_test.go +++ b/pkg/wait/wait_time_test.go @@ -54,10 +54,10 @@ func TestWaitTime(t *testing.T) { func TestWaitTestStress(t *testing.T) { chs := make([]<-chan struct{}, 0) wt := NewTimeList() - for i := 0; i < 10000; i++ { + for i := 0; i <= 10000; i++ { chs = append(chs, wt.Wait(uint64(i))) } - wt.Trigger(10000 + 1) + wt.Trigger(10000) for _, ch := range chs { select { @@ -78,9 +78,9 @@ func BenchmarkWaitTime(b *testing.B) { func BenchmarkTriggerAnd10KWaitTime(b *testing.B) { for i := 0; i < b.N; i++ { wt := NewTimeList() - for j := 0; j < 10000; j++ { + for j := 0; j <= 10000; j++ { wt.Wait(uint64(j)) } - wt.Trigger(10000 + 1) + wt.Trigger(10000) } } -- 2.9.3.windows.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2