diff options
author | Ben Morrison <ben@gbmor.dev> | 2020-05-09 02:06:06 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2020-05-09 02:06:06 -0400 |
commit | d928c73de4c75f3113a4ddb3418789d950097fcb (patch) | |
tree | 3a6bb5ec2e2736a36790cdd3bd7cbc267b95df83 /osversion.go | |
parent | dd81555e6d53c36525358d620d25a9ab042cc9ae (diff) | |
download | api-d928c73de4c75f3113a4ddb3418789d950097fcb.tar.gz |
eliminated query-specific cache checking functions
stub for uptime, will have to adjust output later.
Diffstat (limited to 'osversion.go')
-rw-r--r-- | osversion.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/osversion.go b/osversion.go index eadc960..3ad501a 100644 --- a/osversion.go +++ b/osversion.go @@ -3,37 +3,10 @@ package main import ( "errors" "fmt" - "log" "os/exec" "strings" - "time" ) -// Checks the cache for the freshness of the osversion query. -// If stale, store the query again. -func bapOSVersion(format string) { - path := fmt.Sprintf("/%s/osversion", format) - unNullPage(path) - - if cache.isFresh(path) { - return - } - - bytes, err := osVersionQuery(format) - if err != nil { - log.Printf("Could not query OS version: %s", err.Error()) - bytes = []byte("Internal Error") - } - - cache.Lock() - defer cache.Unlock() - - cache.pages[path] = &page{ - raw: bytes, - expires: time.Now().Add(cacheDuration), - } -} - // executes uname and responds with "$OS $VERSION" in []byte{} func osVersionQuery(format string) ([]byte, error) { out, err := exec.Command("/usr/bin/uname", "-a").Output() |