summaryrefslogtreecommitdiff
path: root/timeoutat/timeoutat.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-05-04 17:51:50 -0400
committerWill Hawkins <[email protected]>2022-05-04 17:51:50 -0400
commit10ddc4e9c56beeb5718cd878313ddf88695a1948 (patch)
tree284c151bae39d24b5fb613dddd858340d8f82bcf /timeoutat/timeoutat.go
parentfa647c6645f74e3c0e6fded658f5f8b5882b0e01 (diff)
Make Traceable Interface and Refactor Debugging
1. Make a traceable interface for all things that can be wrapped in an httptrace.ClientTrace. 2. Refactor debugging system into debug package.
Diffstat (limited to 'timeoutat/timeoutat.go')
-rw-r--r--timeoutat/timeoutat.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/timeoutat/timeoutat.go b/timeoutat/timeoutat.go
index eac57f2..673ca38 100644
--- a/timeoutat/timeoutat.go
+++ b/timeoutat/timeoutat.go
@@ -19,19 +19,18 @@ import (
"fmt"
"time"
- "github.com/network-quality/goresponsiveness/constants"
- "github.com/network-quality/goresponsiveness/utilities"
+ "github.com/network-quality/goresponsiveness/debug"
)
func TimeoutAt(
ctx context.Context,
when time.Time,
- debug constants.DebugLevel,
+ debugLevel debug.DebugLevel,
) (response chan interface{}) {
response = make(chan interface{})
go func(ctx context.Context) {
go func() {
- if utilities.IsDebug(debug) {
+ if debug.IsDebug(debugLevel) {
fmt.Printf("Timeout expected to end at %v\n", when)
}
select {
@@ -39,7 +38,7 @@ func TimeoutAt(
case <-ctx.Done():
}
response <- struct{}{}
- if utilities.IsDebug(debug) {
+ if debug.IsDebug(debugLevel) {
fmt.Printf("Timeout ended at %v\n", time.Now())
}
}()