From b89dae01cc130a7734060074e53e70582d36099b Mon Sep 17 00:00:00 2001 From: Maxton Huff Date: Thu, 11 Feb 2021 16:13:04 -0600 Subject: [PATCH] clarify purpose of trialVersion by changing the name to handleTrialDeadline and adding a doc string --- lattice | 2 +- server/server.go | 2 +- server/trial.go | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lattice b/lattice index fa773628a..28c2313ec 160000 --- a/lattice +++ b/lattice @@ -1 +1 @@ -Subproject commit fa773628a276e2590785a87fbc236c7e88ea6284 +Subproject commit 28c2313ecfcd7e083d42d4e409483e968b4c421b diff --git a/server/server.go b/server/server.go index b68829c4b..b5b43cbc5 100644 --- a/server/server.go +++ b/server/server.go @@ -285,7 +285,7 @@ func (m *Command) SetupServer() error { m.logger.Printf("%s", pilosa.VersionInfo()) - trialVersion(m.logger) + handleTrialDeadline(m.logger) // If the pilosa command line uses -tx to override the // PILOSA_TXSRC env variable, then we must also correct diff --git a/server/trial.go b/server/trial.go index 868a177c5..342d979f9 100644 --- a/server/trial.go +++ b/server/trial.go @@ -27,7 +27,11 @@ import ( "github.com/pilosa/pilosa/v2" ) -func trialVersion(logger loggerLogger) { +// handleTrialDeadline checks to see if this is a trial version of Molecula that expires at some point. +// If it is, we contact an NTP server to get the current time and compare that to the trial deadline. +// We launch two goroutines, one which reminds via a log message how much time is left in the trial, +// and one which causes the process to exit once the trial is over. +func handleTrialDeadline(logger loggerLogger) { if pilosa.TrialDeadline != "" { startTime, err := ntpServerTime(4, logger) if err != nil {