mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Wait some time before displaying the proxy usage log
This commit is contained in:
parent
dd83b68efa
commit
9757784c5a
2 changed files with 7 additions and 1 deletions
|
@ -95,6 +95,12 @@ func (t *Periodic) Start() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (t *Periodic) WaitThenStart() {
|
||||
time.AfterFunc(t.Interval, func() {
|
||||
t.Start()
|
||||
})
|
||||
}
|
||||
|
||||
// Close implements common.Closable.
|
||||
func (t *Periodic) Close() error {
|
||||
t.access.Lock()
|
||||
|
|
|
@ -13,7 +13,7 @@ func NewProxyEventLogger(logPeriod time.Duration, output io.Writer) event.Snowfl
|
|||
logger := log.New(output, "", log.LstdFlags|log.LUTC)
|
||||
el := &logEventLogger{logPeriod: logPeriod, logger: logger}
|
||||
el.task = &task.Periodic{Interval: logPeriod, Execute: el.logTick}
|
||||
el.task.Start()
|
||||
el.task.WaitThenStart()
|
||||
return el
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue