input Getenvs to FlagXYZ

This commit is contained in:
bel
2023-03-25 10:58:13 -06:00
parent ae1e32391c
commit a1a12b1873
9 changed files with 45 additions and 20 deletions

View File

@@ -9,6 +9,10 @@ import (
"time"
)
var (
FlagBufferedStickyDuration = os.Getenv("WRAP_BUFFERED_STICKY_DURATION")
)
type Buffered struct {
ctx context.Context
can context.CancelFunc
@@ -22,7 +26,7 @@ type Buffered struct {
func NewBuffered(ctx context.Context, input Wrap) *Buffered {
ctx, can := context.WithCancel(ctx)
expirationInterval := time.Millisecond * 125
if d, err := time.ParseDuration(os.Getenv("WRAP_BUFFERED_STICKY_DURATION")); err == nil {
if d, err := time.ParseDuration(FlagBufferedStickyDuration); err == nil {
expirationInterval = d
}
result := &Buffered{