[tor-commits] [pluggable-transports/snowflake] branch main updated: Wait some time before displaying the proxy usage log
gitolite role
git at cupani.torproject.org
Wed May 25 15:01:29 UTC 2022
This is an automated email from the git hooks/post-receive script.
cohosh pushed a commit to branch main
in repository pluggable-transports/snowflake.
The following commit(s) were added to refs/heads/main by this push:
new 9757784 Wait some time before displaying the proxy usage log
9757784 is described below
commit 9757784c5aa25a6148f7bdf39295b08c738b06d5
Author: itchyonion <itchyonion at torproject.com>
AuthorDate: Wed Mar 30 12:24:43 2022 -0700
Wait some time before displaying the proxy usage log
---
common/task/periodic.go | 6 ++++++
proxy/lib/pt_event_logger.go | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/task/periodic.go b/common/task/periodic.go
index 37c56eb..7c1a235 100644
--- a/common/task/periodic.go
+++ b/common/task/periodic.go
@@ -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()
diff --git a/proxy/lib/pt_event_logger.go b/proxy/lib/pt_event_logger.go
index df94b0a..cb262e4 100644
--- a/proxy/lib/pt_event_logger.go
+++ b/proxy/lib/pt_event_logger.go
@@ -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
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the tor-commits
mailing list